VE.Direct: websocket and status API response size (#371)
the size allocated for the HTTP request response was too little, while the size for the buffer of the websocket output was increased already. add a new member variable and use it in both context, such that increasing the buffer size to accomodate more space (for the JSON data in particular) will benefit both contexts in the future.
This commit is contained in:
parent
b7214161b8
commit
7c7a15e016
@ -23,4 +23,5 @@ private:
|
||||
uint32_t _lastVedirectUpdateCheck = 0;
|
||||
uint32_t _lastWsCleanup = 0;
|
||||
uint32_t _newestVedirectTimestamp = 0;
|
||||
static constexpr uint16_t _responseSize = 1024 + 128;
|
||||
};
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user