mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
25 lines
424 B
HTML
25 lines
424 B
HTML
<!-- to be used with echo_ws -p 8085 -->
|
|
<html>
|
|
|
|
<head>
|
|
<script>
|
|
|
|
console.log('hello')
|
|
|
|
const ws = new WebSocket('ws://localhost:8085/echo');
|
|
ws.onmessage = (msg) => console.log(`received: ${msg}`);
|
|
|
|
let count = 0;
|
|
setInterval(() => {
|
|
const msg = `hello ${count++}`;
|
|
console.log(`send ${msg}`);
|
|
ws.send(msg);
|
|
}, 2000);
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
open console!
|
|
</body>
|
|
|
|
</html>
|