Socket.io for NodeJS doesn\'t seem to work as a websocket server
For some reason, socket.io ALWAYS fallback to the long polling and if I force the w
Here is the complete working example from one of our working projects:
const websocket = require('ws');
const http = require('http');
const express = require('express');
const app = express();
const server = http.createServer(app);
wss = new websocket.Server({ server });
app.on('upgrade', wss.handleUpgrade);
wss.on('connection', ws => {
console.log('web socket connection is alive');
}
server.listen(8080, () => {
console.log('server started on PORT 8080');
});
translated from Medium