1
0
miroir de https://github.com/s00500/ESPUI.git synchronisé 2025-10-26 03:23:50 +00:00

Knowing websocket msg string length

Cette révision appartient à :
2019-04-15 12:41:22 +02:00
Parent 2c6aaf82f4
révision 36cfe78205

Voir le fichier

@@ -294,6 +294,7 @@ void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventTyp
case WS_EVT_DATA: {
String msg = "";
msg.reserve(len + 1);
for (size_t i = 0; i < len; i++) {
msg += (char)data[i];
@@ -575,7 +576,7 @@ sent as one blob at the beginning. Therefore a new type is used as well
*/
void ESPUIClass::jsonDom(AsyncWebSocketClient *client) {
String json;
DynamicJsonDocument document(8000);
DynamicJsonDocument document(4000);
document["type"] = (int)UI_INITIAL_GUI;
JsonArray items = document.createNestedArray("controls");