Hi I’ve been setting up this simple server and client and it’s been going all well for me. I recently added some things not related to the server in a separate file and it’s still fine. Then out of nowhere
Error during WebSocket handshake: Unexpected response code: 502
How do I fix it?
The client is untouched; the only modifications I made was to the server.
const WebSocket = require(‘ws’);
const wss = new WebSocket.Server({ port: 8080 });
wss.on(‘connection’, function a(socket) {
connection(socket)
});
var server = http.createServer(function(request, response) {
response.writeHead(404);
response.end();
});
server.listen(process.env.PORT || 8080, function httpListening() {
console.log((new Date()) + ". \nServer turned on, listening on port "+server.address().port + “.”)
});
Any help would be appreciated. I’m very new to Websocket. Thanks!