Socket.io v1.x Library for W5100 & ENC28J60 + ESP8266

Thanks for your ...quick response :slight_smile:

Mean while can you help me with some source where can I start learning ? ....at least to get some overview, please.

Thanks,
Teja

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

Hi,
this is a know issue with a fix on github
the fix will be added to the next version

Hello,

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.

Do you have any suggestions i might try?

Hi,

I have not tried the w5500 yet
I might order one at some point
most of the code should work though without any modification.
probably some changes in the ethernet library
I will investigate
meanwhile, you can try editing the lib
according to Arduino - Home
NB. You can reuse your code written for Arduino Ethernet Shield, simply replacing
#include <Ethernet.h> --> #include <Ethernet2.h>
#include <EthernetUdp.h> --> #include <EthernetUdp2.h>

I got the library working with communication between server and web-client and between server and ESP8266.

I have one problem: data are received on the ESP8266 (log-msg) but not delivered to the application.

  if (client.monitor()) {
    lastreply = millis();
    Serial.println(RID);
    Serial.println(Rname);
    Serial.println(Rcontent);
    }
  }

I get no print of RID, Rname and Rcontent in my client.monitor

I also tried to implement a callback routing like this:

void ondata(SocketIOClient client, char *data) {
  Serial.print(data);
}

registering the callback in setup() like this:

client.setDataArrivedDelegate(ondata);

But this also not works.

I cannot understand from the SocketIOClient.cpp how the callback is called???

Any help is highly appreciated.

After looking into the library code, I see that the monitor function does not return true.

I added this and it works fine now.

For reference I attach my revised library.

Changes in SocketIOClient.cpp and example

Sorry - I try again.

socketio.zip (10.6 KB)

socketio.zip (10.6 KB)

Sorry to bump an older post, but I have jumped into the world of websockets without a clue of what I am doing (the more I learn, the more I realize what I don't know). This is the only library that I've found that deals with socket.io after version 1.0, and the only one where I've gotten the example to actually work!

What I am working on currently will send and receive JSON data through a socket.io server on a computer that will in turn be sending and receiving data from another "black box" (doesn't really matter, which is the whole point of websockets).

I'm using an Adafruit capacitive touch sensor and some LEDs to indicate what has been touched at my end, sending that data and receiving data to also control the LEDs from the other end. This was originally done using the serial port to talk to the black box, but it ended up with considerable distance and the USB extender we used seems to have issues with being used for a serial port (drops the connection after a while - end up having to reboot both ends to get it working again). Websockets was the solution the programmer of the black box wanted, so here I am trying to catch up.

TLDR: I still don't know what I don't know. Would anyone who has used this library care to share some of their code so I can learn from the examples?

Hi,

Thanks for bringing this thread back to life

I have been mostly on github lately.
I also replied to your PM.

Let me know if you need anything

Sir/Madam,

I am using BH-MSD-2A driver with BH42SH38-1684 LA-TR 8X8 BIPOLAR stepper motor so how should I calibrate it with my arduino board to operate it with potentiometer of 1 M ohm and also to operate it for fixed rotation for clock wise and anti clockwise direction.

As it been discussed on github, there is a bug, and the connection is lost after 3', does anyone succeeded in maintaining the connection during a long time ?

does w5100 ethernet module support websockets or long polling methods to communicate with server

Why the lib won't work with an Arduino Wifi Uno? Arduino - Home
I there any chance I can set up a websocket on this board?

I never tried the uno wifi but my bet is that the communication to the ESP8266 is serial meaning we cannot establish directly the websocket on it.

Is there a websocketlib for the arduino wifi?

Hi, i can start server and connect by web browser but uno + ethernet shield is not, please help me solve this problem, many thanks

Hi,

could you post more information and the code here?
did you change the #define?

Hi, let me ask one question I did not find anywhere.
How can be get msg from the server?, I check the doc, but, as I said, not find any command to do that.
Thanks,

there are 3 variables :
extern String RID;
extern String Rname;
extern String Rcontent;

in the void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
//client.heartbeat(0);
client.send("atime", "message", "Time please?");
}
if (client.monitor())
{
Serial.println(RID);
if (RID == "atime" && Rname == "time") // this is how you get the data
{
Serial.print("Time is ");
Serial.println(Rcontent);
}
}
}