Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.9k stars 555 forks source link

Client does not reconnect to NodeJS WebSocket server #312

Open janoist1 opened 6 years ago

janoist1 commented 6 years ago

Hi, I'm using the client lib on an ESP8266-01. On the other end there is a NodeJS server running (using the WS lib). I'm not sure what's going on but the system is really fragile. It works for a while then, sometimes disconnects then reconnects - which is okay. Although, sometimes it gets stuck and does not reconnect, just keeps trying. Some debug from the client:

[WS-Client] connection lost. [WS-Client] client disconnected. [WS-Client] connect ws... [WS-Client] connected to :80. [WS-Client][sendHeader] sending header... [WS-Client][sendHeader] sending header... Done (2377935us).

After "sending header done" it waits some time then repeats the log above.

On the server, there is no sign of the connection attempt (in Heroku logs there is no sign of even hitting the router).

What could be the problem? Lots of thanks. 👍

sovcik commented 6 years ago

Had similar issue (NodeJS+ESP8266-07s). It was caused by losing TCP connection, more precisely: wifi was still connected, but router to Internet was down. From what you wrote about no sign in Heroku logs - that could be it.