Slight websocket reconnection tweaks

This commit is contained in:
cschwinne
2022-02-19 22:47:17 +01:00
parent 7f92607b85
commit efbb7a034c
3 changed files with 826 additions and 821 deletions

View File

@@ -113,7 +113,8 @@ void sendDataWs(AsyncWebSocketClient * client)
size_t heap2 = ESP.getFreeHeap();
if (!buffer || heap1-heap2<len) {
releaseJSONBufferLock();
ws.cleanupClients(0); // disconnect all clients to release memory
ws.closeAll(1013); //code 1013 = temporary overload, try again later
ws.cleanupClients(0); //disconnect all clients to release memory
return; //out of memory
}
serializeJson(doc, (char *)buffer->get(), len +1);
@@ -159,7 +160,7 @@ void handleWs()
if (millis() - wsLastLiveTime > WS_LIVE_INTERVAL)
{
#ifdef ESP8266
ws.cleanupClients(2);
ws.cleanupClients(3);
#else
ws.cleanupClients();
#endif