update example

This commit is contained in:
Mathieu Carbou
2024-10-15 11:22:07 +02:00
parent 139099ebd9
commit d6ce30f2b7

View File

@@ -27,7 +27,7 @@
#include <LittleFS.h>
const char* htmlContent = R"(
const char* htmlContent PROGMEM = R"(
<!DOCTYPE html>
<html>
<head>
@@ -87,6 +87,8 @@ const char* htmlContent = R"(
</html>
)";
const size_t htmlContentLen = strlen_P(htmlContent);
AsyncWebServer server(80);
AsyncEventSource events("/events");
AsyncWebSocket ws("/ws");
@@ -386,7 +388,7 @@ void setup() {
// > brew install autocannon
// > autocannon -c 10 -w 10 -d 20 http://192.168.4.1
server.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
request->send(200, "text/html", htmlContent);
request->send(200, "text/html", (uint8_t*)htmlContent, htmlContentLen);
});
server.on("/file", HTTP_GET, [](AsyncWebServerRequest* request) {