Right now, my lib supports Socket.io v1.x and node.js v0.12.2 and arduino 1.6.3
it uses websocket, masking frames as requested with the new version of socket.io
I will set up an account on github and post it soon (just need to clean up a little bit and try to make it work for ENC28j60)
Hope it helps the community
Edit: Added an example to show basic communication with node.js server
OMG THANK YOU!!!!!!! Seriously, I have been trying on and off for months to get a working arduino socket.io setup going. I have most of the MEAN stack finished for my security system server but couldn't get away from REST for the arduino itself.
I can't believe nobody has commented on this. This has saved my life man. Your code is so simple and easy to understand which is important to me as a beginner/intermediate programmer. When I couldn't get it to work I just skimmed your .cpp and .h and it all made so much sense.
Now my arduino can connect to my server via socket.io and I can arm/disarm my alarm remotely (in a better way than I was before).
This made my day. Nay, my month. Keep working on this and get that git-hub working. People should flock to this, it's so extremely useful.
So, as you know, the send() function accepts three strings; one for the socket.io ".on" identifier (not sure what its called), one for the key and one for the value. Then it makes an object out of it and sends it off.
I modified it to accept a string that is in JSON format. This way instead of a single key:value pair I can now send an entire object with multiple key:value pairs.
Then in my arduino code I made a quick little function "jsonBuilder". I run it whenever I want to send data over the socket and it constructs a string out of my data and sends it off with the modified send() function.
Works great! I am able to send my entire security system status in a single object in one single send() call.
Sorry my reply is so late now haha! I was out of town for military stuff since November and have had ZERO "fun time" (programming, electronics, etc.) since then!
Now the hard part is pulling all my code back up and remembering what is what! God I hate when I have to take a long break from these things.
Anyways, definitely an awesome library man. I can't say enough how much you saved me here. I searched for months and months and months before finding your library. I think part of why you haven't gotten many replies is that this is still new stuff. I mean, sockets like this have been around forever, but you just don't see that many people who are working on socket.io with arduino, and when they do it's all hard wired USB and just other things that I don't want.
I am an amateur with all this (experienced amateur I suppose at this point) and the only reason I took the dive to start learning socket.io, node.js, angular.js, mongo etc was because my buddy highly recommended it. And he is a 'cutting edge' type software developer. He spends most of his time working with beta tech stuff like the virtual reality stuff right now for example. He turned me onto all these javascript based socket connections and said they will be more popular later when more is done with them. They definitely improved my security server dramatically.
you just need to edit the .h file depending on your needs
//Uncomment the correct line
//#include <Ethernet.h> //For W5100
//#include <UIPEthernet.h> //For ENC28J60 #include <ESP8266WiFi.h> //For ESP8266
Really nice, man. I'll test it today.
I don't know if it helps, but this WebSocket library GitHub - Links2004/arduinoWebSockets: arduinoWebSockets seems to support secure websocket and be more up to date than Bill Roy's.
I have a SparkFunESP8266 shield. I connected to the wifi network and I want to use socket.io on this one.
Iam trying to use your library but Iam stuck .... I do not know C++ ... it`s my first time ...
I use on setup
client.setDataArrivedDelegate(ondata);
if (!client.connect(server, port)){
Serial.println(F("Not connected."));
}
.... on SocketIOClient::connect sendHandshake(hostname) works and I can see in node console that a new connection was make ... problem comes on ::readhandshake on
if (atoi(&databuffer[9]) != 200) {
while (client.available()) readLine();
client.stop();
return false;
}
... it returns always false ... it seems data databuffer is empty
If i uncomment in the ::readLine (Serial.print(c); //Can be used for debugging)
Hey,
did you get the latest version from Github? (not the beta, I still need to finish it)
what version of node.js and socket.io are you using?
did you modify the provide app.js?
Dear washo4evr, I'm new in Arduino, so may be my question will looks strange, so could You please explain to which pins on ESP8266 should ENC28J60 connectrd to. In Enc28J60Network.h I found lines #define ENC28J60_CONTROL_CS SS #define SPI_MOSI MOSI #define SPI_MISO MISO #define SPI_SCK SCK #define SPI_SS SS
but I can't understod which pins on ESP8266 board corresponds to MOSI, MISO,SCK asd SS names.
Hey,
thank you for your kind message.
a wiki has been started and should be available on github soon as well as the new version which will include HTTP REST functions
Hi!
I'm starting to use this great library!
But I can not receive from the Node long strings,
these are truncated !!
I Uncomment line 145 SocketIOClient.cpp to show (databuffer), which
instead it contains the whole string.
How can I do to valorize (Rcontent) with long strings (600 characters)?
Thank you
First of all thank you for the library. It works perfect with W5100.
I am now the owner of a new Ethernet Shield 2 - W5500 chip. I work with arduino ide 1.7.9 and Ethernet2 library.
I tried to combine the ethernet2 with socket.IO and i had partly success. My setup is a Mega and Ethernet shield 2. I connected to a Socket.IO server, but it disconnects from it and never sends any message.
I don't know if it is a chip error or the libraries are not completely compatible.