messages working
This commit is contained in:
parent
1893eb0599
commit
01e9b47bc7
6 changed files with 165 additions and 111 deletions
12
public/index.js
Normal file
12
public/index.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
const socket = new WebSocket("ws://localhost:8080/websocket");
|
||||
|
||||
socket.addEventListener("message", (event) => {
|
||||
let messages = document.getElementById("messages");
|
||||
messages.appendChild(`<li>${event.data}</li>`)
|
||||
});
|
||||
|
||||
function myFunction() {
|
||||
socket.send(document.getElementById("inp").value);
|
||||
|
||||
return false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue