Upgrade Required?

nodejs

#1

I’m trying to start a webscket server by using the module “ws” as below:

const WebSocket = require('ws');

const wss = new WebSocket.Server({ port: 8080 });

wss.on('connection', function connection(ws) {
  ws.on('message', function incoming(message) {
    console.log('received: %s', message.toString());
  });
    ws.send('something');
});

but when I start I get a 502, and “Upgrade Required” on the page. What can this be?