You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
550 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
const ws = new WebSocket("ws://localhost:3003");
ws.onopen = () => {
console.log("Connected to server");
ws.send("Hello from client!");
};
ws.onmessage = event => {
console.log(`Message from server: ${event.data}`);
};
ws.onclose = () => {
console.log("Disconnected from server");
};
</script>
</body>
</html>