Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.86k stars 550 forks source link

Stuck in websocket.loop() #526

Open spamws opened 4 years ago

spamws commented 4 years ago

Hi If server unavailable or server is down, check few hours cause the websocketClient stuck in loop. When disconnect wifi or reset esp8266 everything is OK. How we can exit from websocket.loop() in specific time and goto next line main loop? For example 10 second if websocket not connect. Current time out not work Properly with that condition. Thanks in advance

JoarGjersund commented 4 years ago

I am having sort of the same problem. Both websocket.loop and websocket.broadcastPin works fine for a while, but then after a while starts getting slow and spends around 10 sec. each to return to the main loop. I tried changing the WEBSOCKETS_TCP_TIMEOUT to a smaller value, but it didnt seem to make any difference. I am working with ESP32.

JoarGjersund commented 4 years ago

Also had a look in the WiFiClient library. Changed the WIFI_CLIENT_SELECT_TIMEOUT_US which was 1000000 and WIFI_CLIENT_MAX_WRITE_RETRY which was 10. Also did not seem to fix the problem. It does however seem to be the websocket.broadcastPing that is causing most trouble for me, which I find weird since it shouldn't really wait for anything from the client side.

whakru commented 4 years ago

Та же проблема. Esp8266

Links2004 commented 4 years ago

can you check with the latest master, the yield handling has been reworked which may helps. since the TCP stack gets more time to handle packets and disconnected.