diff --git a/include/WebApi_ws_vedirect_live.h b/include/WebApi_ws_vedirect_live.h index f85f332a..d17f51c0 100644 --- a/include/WebApi_ws_vedirect_live.h +++ b/include/WebApi_ws_vedirect_live.h @@ -23,4 +23,5 @@ private: uint32_t _lastVedirectUpdateCheck = 0; uint32_t _lastWsCleanup = 0; uint32_t _newestVedirectTimestamp = 0; + static constexpr uint16_t _responseSize = 1024 + 128; }; \ No newline at end of file diff --git a/src/WebApi_ws_vedirect_live.cpp b/src/WebApi_ws_vedirect_live.cpp index e416ff87..f4835e4c 100644 --- a/src/WebApi_ws_vedirect_live.cpp +++ b/src/WebApi_ws_vedirect_live.cpp @@ -61,7 +61,7 @@ void WebApiWsVedirectLiveClass::loop() String buffer; // free JsonDocument as soon as possible { - DynamicJsonDocument root(2048); + DynamicJsonDocument root(_responseSize); JsonVariant var = root; generateJsonResponse(var); serializeJson(root, buffer); @@ -173,7 +173,7 @@ void WebApiWsVedirectLiveClass::onLivedataStatus(AsyncWebServerRequest* request) return; } try { - AsyncJsonResponse* response = new AsyncJsonResponse(false, 1024U); + AsyncJsonResponse* response = new AsyncJsonResponse(false, _responseSize); JsonVariant root = response->getRoot(); generateJsonResponse(root);