Skip to content

Instantly share code, notes, and snippets.

@nickcharlton
Created September 8, 2022 13:47
Show Gist options
  • Save nickcharlton/43fa8eef090f3bca37d99b84ebe145d6 to your computer and use it in GitHub Desktop.
Save nickcharlton/43fa8eef090f3bca37d99b84ebe145d6 to your computer and use it in GitHub Desktop.
A basic Web Sockets client demo
<html>
<head>
<script>
const webSocket = new WebSocket("ws://localhost:4283/ws");
webSocket.onmessage = (event) => {
console.log(event.data);
}
window.webSocket = webSocket;
</script>
</head>
<body>
<h1>Web Sockets Demo</h1>
<div id="output"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment