Skip to content

Conversation

@kenkus-futurice
Copy link
Contributor

I needed a websocket client able to communicate with a socket.io server so I modified the handshake to be compatible for socket.io server.

@linchpinstudios
Copy link

Is this something that is going to get merged? I'm currently running into this issue. I'm going to pull the fork and use that, but it would be nice if it was part of the main package.

@Links2004 Links2004 merged commit 529a86c into Links2004:master Sep 11, 2016
@kiralikbeyin
Copy link

@kenkus-futurice @linchpinstudios @Links2004 Do you have working socket.io server? Which version socket.io do you use? Can you give an example?

@Links2004
Copy link
Owner

I have a working setup with socket.io v0.9 with:
https://gist.github.com/Links2004/25966845ed38278bb4a2f4a44b5a30fb

but this commit is for socket.io v1 never tried it since my server runs 0.9.

@kiralikbeyin
Copy link

socket.io 0.9.0 published 2012 this is too old and probably will break other libs in node server.
Any other alternative? I want to use web socket client but its own web server example didn't work also.. I got only disconnected msgs when i shut the server - no connected or any msg send.

@kenkus-futurice
Copy link
Contributor Author

kenkus-futurice commented Sep 30, 2016

@kiralikbeyin, do you mean a socket.io server that would run on Arduino? I just modified the websocket client in this lib to be compatible with the node socket.io server (and I made a huge number of compromises due to memory constraints). I believe I used the latest version of socket.io server back then (in June).

@kiralikbeyin
Copy link

@kenkus-futurice I have a socket.io server (tested with 1.4.5 and 1.4.8) , esp8266 nodemcu 1.0 is not sending message or connecting.. When server is working i get only [WSc] Disconnected! when server shut down no message in serial

@kenkus-futurice
Copy link
Contributor Author

kenkus-futurice commented Sep 30, 2016

Sounds like the handshake fails at some point. I try to look into that if I have some time on weekend. No message in the Serial is normal as one of the compromises was to omit error handling. It could be a good time to make a proper socket.io only client (I have never used any other websocket implementation) as esp8266 has some decent amount of memory. There was also another Arduino websocket lib with more features (but not socket.io compatible) which did not fit into the memory of my Mega2560. Perhaps could build on top of that lib?

@kenkus-futurice
Copy link
Contributor Author

kenkus-futurice commented Oct 2, 2016

@kiralikbeyin, my bad, WebSocketClientSocketIO.ino example has a stupid bug:

This line:
webSocket.begin("192.168.0.123", 81);

should be:
webSocket.beginSocketIO("192.168.0.123", 81);

I tested with node socket.io server 1.4.8 and it seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants