Implemented periodic called loop method in webapi

This commit is contained in:
Thomas Basler 2022-06-15 22:53:05 +02:00
parent 75bae16f92
commit cae47a142a
3 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,7 @@ class WebApiClass {
public:
WebApiClass();
void init();
void loop();
private:
AsyncWebServer _server;

View File

@ -97,6 +97,12 @@ void WebApiClass::init()
_server.begin();
}
void WebApiClass::loop()
{
// see: https://github.com/me-no-dev/ESPAsyncWebServer#limiting-the-number-of-web-socket-clients
_ws.cleanupClients();
}
void WebApiClass::onNotFound(AsyncWebServerRequest* request)
{
// Handle Unknown Request

View File

@ -96,4 +96,6 @@ void loop()
yield();
MqttPublishing.loop();
yield();
WebApi.loop();
yield();
}