websocket not working
This commit is contained in:
parent
46ad5b3bf7
commit
964c90d2f2
5 changed files with 136 additions and 54 deletions
|
|
@ -4,6 +4,17 @@
|
|||
<link rel="stylesheet" href="/public/index.css">
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Hello World!</title>
|
||||
<script>
|
||||
const socket = new WebSocket("ws://localhost:8080/websocket");
|
||||
|
||||
socket.addEventListener("open", (event) => {
|
||||
socket.send("Hello Server!");
|
||||
});
|
||||
|
||||
socket.addEventListener("message", (event) => {
|
||||
console.log("Message from server ", event.data);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue