im just beggining to use typescript + node + websockets, and i watched a youtube tutorial and did literally everything the way they did it. and yet my localhost:8080 keeps on saying "upgrade required".
this is the server side code:
import { WebSocket } from "ws";
const port = 8080;
const wss = new WebSocket.Server({port});
console.log(`Listening at ${port}`);
wss.on('connection', ws => {
console.log('client connected');
ws.on('close', () => {
console.log('client disconnected');
});
});
and this is the index.html
<!DOCTYPE html>
<html>
<head>
<style>
#canvas {
margin-left: auto;
margin-right: auto;
display: flex;
background-color: #383636;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<script src="index.js"></script>
</body>
</html>
the client sided index.js is empty. the youtube tutorial told me to do it this way. but it just doesnt work. what is going on?
also the console.logs dont work