Hi,
I've really wanted to use webSockets with the Espruino & esp8266 as an http/webSockets server
but I was having some issues, namely:
the webSocket handshake was not completing until the server did its first send somewhere later, leaving the client waiting and unable to send data before the server did
the client was closing the socket after 1 minute of inactivity because it was expecting the server to ping
the server didn't know or gracefully close when the the client closed the webSocket
So I learnt more than I thought I would about the webSocket protocol and made the attached, simple changes that address these requirements (renaming the module to wsX.js just to avoid conflicts). A simple diff between the attached file and the hosted module will show you the few changes and I've added comments to explain, but feel free to remove these.
I'm now finding webSockets very reliable and doing what I need. I hope the changes I'm offering make it into the hosted module.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I've really wanted to use webSockets with the Espruino & esp8266 as an http/webSockets server
but I was having some issues, namely:
So I learnt more than I thought I would about the webSocket protocol and made the attached, simple changes that address these requirements (renaming the module to wsX.js just to avoid conflicts). A simple diff between the attached file and the hosted module will show you the few changes and I've added comments to explain, but feel free to remove these.
I'm now finding webSockets very reliable and doing what I need. I hope the changes I'm offering make it into the hosted module.
1 Attachment