-->
Page 1 of 2

Simple Lua Websocket Server example

PostPosted: Thu Sep 07, 2017 3:41 am
by death_soldier
I need a websocket server example for nodeMCU(Lua Firmware).
Is there anyone that knows anything about it ?

Re: Simple Lua Websocket Server example

PostPosted: Thu Sep 07, 2017 9:23 am
by Godzil
You can have a look at what nodemcu-webide (using httpserver) is doing: https://github.com/moononournation/node ... socket.lua

This version use httpserver as a backend (for mainly the first connection step, all the websocket itself is handeld by that file)

You can also look at the original file (by creationix) : https://github.com/creationix/nodemcu-w ... socket.lua
(but I can't say for sure if it works well)

At least it can give an idea on how to do it

Re: Simple Lua Websocket Server example

PostPosted: Fri Sep 08, 2017 6:03 pm
by death_soldier
But on the Node MCU with arduino firmware , have a library which implement websocket server.
How can exist that, If the mother language of the Node(LUA) doesn't implemented ?

Re: Simple Lua Websocket Server example

PostPosted: Sun Sep 10, 2017 5:46 am
by Godzil
I'm not sure to understand.

Both I gave you are websocket server implementation in lua, and at least the first one work (as I tested it) but I'm sure that the second work too.

There is a "websocket" module for NodeMCU firmware, but it is client only, there is no server module, if you want one, you will have to make it and I don't think it would be accepted in the official firmware (but I may be wrong)

The implementation made in lua works, so why it does not fulfils your needs?