diff --git a/examples/SimpleServer/SimpleServer.ino b/examples/SimpleServer/SimpleServer.ino index b3e3281..899c77d 100644 --- a/examples/SimpleServer/SimpleServer.ino +++ b/examples/SimpleServer/SimpleServer.ino @@ -463,6 +463,10 @@ void loop() { } if (now - lastWS >= deltaWS) { ws.printfAll("kp%.4f", (10.0 / 3.0)); + // ws.getClients + for (auto& client : ws.getClients()) { + client.text("kp%.4f", (10.0 / 3.0)); + } lastWS = millis(); } } diff --git a/src/AsyncWebSocket.h b/src/AsyncWebSocket.h index 2fe14d1..1da3d15 100644 --- a/src/AsyncWebSocket.h +++ b/src/AsyncWebSocket.h @@ -351,7 +351,7 @@ class AsyncWebSocket : public AsyncWebHandler { AsyncWebSocketMessageBuffer* makeBuffer(size_t size = 0); AsyncWebSocketMessageBuffer* makeBuffer(const uint8_t* data, size_t size); - const std::list& getClients() const { return _clients; } + std::list& getClients() { return _clients; } }; // WebServer response to authenticate the socket and detach the tcp client from the web server request