get lage sensor data from ESP ( Json) #232
Closed
EmileSpecialProducts
started this conversation in
General
Replies: 3 comments 1 reply
-
You can use stream, chunk, SSE, websocket, |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is how i Resolved it, and works for one request at a time.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I found a solution for me that works. not sure if it is the best, but it works. I create the webpage in a file, using LittleFS. After creating I show the html by loading the file. File file = LittleFS.open("/myhtml.html", "r");
if (file) {
AsyncWebServerResponse* response = _request->beginChunkedResponse(
"text/html",
[file](uint8_t* buffer, size_t maxLen, size_t index) mutable -> size_t {
size_t bytesRead = file.read(buffer, maxLen);
if (bytesRead == 0) {
file.close();
LittleFS.remove("/myhtml.html");
}
return bytesRead;
}
);
for (const auto& header : _headers) {
response->addHeader(header.first, header.second);
}
_request->send(response);
_headers.clear();
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to return sensor data from the ESP in Json format.
Not using the https://arduinojson.org/ as this will not solve my issue.
This works great using this code if the data <64K
But if the data is more then 64K byte i have a memory problem ( String only support 64K )
But how can I send blocks of data so that I do not need to have all the Jsondata in memory?
PlatformIO.ini settings
Size Limits with Responses
Beta Was this translation helpful? Give feedback.
All reactions