ArduinoJson library with ESP32 Web Server using Server-Sent Events (SSE)
Is it the right way to use ArduinoJson library with ESP32 Web Server using Server-Sent Events (SSE) to avoid memory fragmentation or other potential issues Thank you
void sendWES_displayWebBrowser() {
/*
{"solar_watt":10000,"pool_watt":10000,"pac_watt":10000,"IINST1":10,"IINST2":10, "IINST3":10}
Data structures 96 Bytes needed to stores the JSON objects and arrays in memory Strings 0 Bytes needed to stores the strings in memory Total (minimum) 96 Minimum capacity for the JsonDocument. Total (recommended) 96 Including some slack in case the strings change, and rounded to a power of two
*/
DynamicJsonDocument json_wes(96); /* Allocate a temporary JsonDocument */
json_wes["solar_watt"] = solar_watt; json_wes["pool_watt"] = pool_watt; json_wes["pac_watt"] = pac_watt; json_wes["IINST1"] = IINST1; json_wes["IINST2"] = IINST2; json_wes["IINST3"] = IINST3;
char buffer_json_wes[96];
serializeJson(json_wes, buffer_json_wes);
/* https://github.com/me-no-dev/ESPAsyncWebServer#setup-event-source-on-the-server */
events.send(buffer_json_wes,"wes.json" ,millis());
json_wes.clear();
}