Open contact-circularblue opened 7 years ago
Hi, yes this is a know "issue" I put "" since it is not actually a big issue
im still hoping to have more free time since I moved recently closer to work so I can resume my work you can use a timer library to 'ping' every 10s or so to be sure not to loose connection
let me know if your need help (it will be in the next version by default
Hello @washo4evr ,
Any hint where we can search into your code to help you fixing this issue ?
++
Hi,
Yes, I would recommend to look at void SocketIOClient::heartbeat(int select) if you can call that function every 10s, 30s...or anything like that, then you wont get disconnected
I use the timer library to do that and it work already kept my ESP8266 updatiing my server all night long
I ordered an ESP32 last week, I should be getting it soon. Then it will be time to (finally) update this library.
Thanks for your patience
Yes I have noticed that if you keep on sending data, the connexion never break. Calling herthbeat each 10s could be a "solution", but is doesn't really fix the issue. Do you know if the connection is broken by the server or by the ESP ?
I have added an heartbeat each second => the ESP is connected and operational since 8 days (non stop !) .
This is great news.
from my testing, you can lower the heartbeat to every 30 s and it should be fine (will also save some power if running on battery)
Yep, but do you have any hint of the root problem ? Or an heartbeat is required into the core structure of socket.io ?
off topic: french btw ? I saw french words into your code !
@washo4evr just to let you know that considering that I have talking to my server each 3' to check if it is still online I don't need heartbeat at all. The server ping is just like the heartbeat function but with a server state as a return. My ESP uptime is now: 2 months without any reboot !
Hi, Et bonjour aussi.
This is great news. 2 months without crash is great.
I finally got my ESP32 working on my machine. I hope to have good news soon (Socket.IO v2.x + ESP32)
Socket.IO v2.x + ESP32 are now supported
Dear all,
I don't know if this subject remains hot, however I would like to share how am I handling the pingTimeout.
First of all, on the server side I am using nodejs/socket.io where we can use the following options to set the socket.io: pingInterval: 10000, pingTimeout: 5000
. Upon new readHandshake
pingTimeout can be read as follows:
int pingtimeoutindex = tmp.indexOf("pingTimeout") + 7; int pingtimeoutendindex = tmp.indexOf("}", pingtimeoutindex + 6); int pingtimeoutcount = pingtimeoutendindex - pingtimeoutindex - 6; for (int i = 0; i < pingtimeoutcount; i++) { pingTimeoutRead[i] = databuffer[i + pingtimeoutindex + 6]; } //convert pingTimeout to int pingTimeout = atoi(pingTimeoutRead);
This enables me to use the same pingTimeout on my ESP8266 to keep the connection alive with the same interval defined on the server side - no more, no less.
On ESP8266 loop I can now use this external pingTimeout
value and apply the heartbeat(0) like washo4evr does in the example.
Hope this helps someone with the keep-alive issue.
Cheers,
Hi, I am using socket.io and with Node.js on server. The client ESP8266 connects successfully but the problem that i am facing is 'ping time out'. When the connection is idle for around 1-2 minutes the the ESP8266 client ping time outs on the server and gets disconnected.