From 82460d4aed98ec6aeeb7d2d88710f863162bde0a Mon Sep 17 00:00:00 2001 From: ChrSchu Date: Sun, 2 Jun 2024 23:21:38 +0200 Subject: [PATCH] Trigger a websocket client cleanup on new connection to disconnect old clients and releasing the memory --- src/ESPUI.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ESPUI.cpp b/src/ESPUI.cpp index 8c95880..eb1abfe 100644 --- a/src/ESPUI.cpp +++ b/src/ESPUI.cpp @@ -449,6 +449,11 @@ void ESPUIClass::onWsEvent( } else { + if(type == WS_EVT_CONNECT) + { + ws->cleanupClients(); + } + if (MapOfClients.end() == MapOfClients.find(client->id())) { // Serial.println("ESPUIClass::OnWsEvent:Create new client.");