diff --git a/include/WebApi.h b/include/WebApi.h index 2d828395..69757dc1 100644 --- a/include/WebApi.h +++ b/include/WebApi.h @@ -31,7 +31,7 @@ private: WebApiSysstatusClass _webApiSysstatus; WebApiWebappClass _webApiWebapp; WebApiWsLiveClass _webApiWsLive; - unsigned long lastTimerCall = 0; + unsigned long _lastWsCleanup = 0; void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len); }; diff --git a/src/WebApi.cpp b/src/WebApi.cpp index 0194ff7c..51e599f6 100644 --- a/src/WebApi.cpp +++ b/src/WebApi.cpp @@ -47,9 +47,9 @@ void WebApiClass::loop() _webApiWsLive.loop(); // see: https://github.com/me-no-dev/ESPAsyncWebServer#limiting-the-number-of-web-socket-clients - if (millis() - lastTimerCall > 1000) { + if (millis() - _lastWsCleanup > 1000) { _ws.cleanupClients(); - lastTimerCall = millis(); + _lastWsCleanup = millis(); } }