gilmaimon / ArduinoWebsockets

A library for writing modern websockets applications with Arduino (ESP8266 and ESP32)
GNU General Public License v3.0
482 stars 97 forks source link

when the websocket client disappears from the network #123

Closed qlalfdu closed 3 years ago

qlalfdu commented 3 years ago

If the WebSocket client moves to another location and disappears from the network while ESP32 is operating as a server, it does not operate for 20 seconds.

I am using esp32. This symptom appears when the smartphone is moved to another location while connected to the esp32 server. Please let me detect that the socket connection has disappeared abnormally. Or any ideas to reduce the 20 seconds of stopping to work? Thank.

My code: void loop() { server.handleClient(); webSocket.loop(); if (webSocket.connectedClients() > 0) { String s = String(millis()); webSocket.broadcastTXT(s); webSocket.broadcastTXT("\n"); delay(1000); } }