Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- <script type="text/javascript">
- const url = "ws://localhost:9000/ageMe";
- const socket = new WebSocket(url);
- socket.onopen = () => {
- console.log("Websocket opened");
- socket.send(JSON.stringify({name: "Erwin", age: 26}))
- };
- socket.onmessage = (event) => {
- console.log(event.data)
- }
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement