Skip to content

Commit ce6f7b2

Browse files
committed
WS: Add browser sending in example
1 parent 4306f1f commit ce6f7b2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

examples/WebSocket/WebSocket.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ static const char *htmlContent PROGMEM = R"(
4949
ws.send(message);
5050
console.log("WebSocket sent: " + message);
5151
}
52+
setInterval(function() {
53+
if (ws.readyState === WebSocket.OPEN) {
54+
ws.send("msg from browser");
55+
}
56+
}, 1000);
5257
</script>
5358
</body>
5459
</html>

0 commit comments

Comments
 (0)