update example

This commit is contained in:
Mathieu Carbou
2024-10-15 21:22:52 +02:00
parent a4237ae5e4
commit 58c4c64dfd

View File

@@ -87,8 +87,6 @@ const char* htmlContent PROGMEM = R"(
</html> </html>
)"; )";
const size_t htmlContentLen = strlen_P(htmlContent);
AsyncWebServer server(80); AsyncWebServer server(80);
AsyncEventSource events("/events"); AsyncEventSource events("/events");
AsyncWebSocket ws("/ws"); AsyncWebSocket ws("/ws");
@@ -388,7 +386,7 @@ void setup() {
// > brew install autocannon // > brew install autocannon
// > autocannon -c 10 -w 10 -d 20 http://192.168.4.1 // > autocannon -c 10 -w 10 -d 20 http://192.168.4.1
server.on("/", HTTP_GET, [](AsyncWebServerRequest* request) { server.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
request->send(200, "text/html", (uint8_t*)htmlContent, htmlContentLen); request->send(200, "text/html", htmlContent);
}); });
server.on("/file", HTTP_GET, [](AsyncWebServerRequest* request) { server.on("/file", HTTP_GET, [](AsyncWebServerRequest* request) {
@@ -579,7 +577,6 @@ void loop() {
} }
if (now - lastWS >= deltaWS) { if (now - lastWS >= deltaWS) {
ws.printfAll("kp%.4f", (10.0 / 3.0)); ws.printfAll("kp%.4f", (10.0 / 3.0));
// ws.getClients
for (auto& client : ws.getClients()) { for (auto& client : ws.getClients()) {
client.printf("kp%.4f", (10.0 / 3.0)); client.printf("kp%.4f", (10.0 / 3.0));
} }