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
I had the exact same issue because I was defining 'io' twice. Double check where you are defining io in your code and ensure you are not defining the variable io twice.
Example of what I was doing wrong:
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var io = require('socket.io').listen(server.listen(config.port, config.ip, function () {
console.log('Express server listening on %d, in %s mode', config.port,
app.get('env'));
}));
Example of what fixed the issue:
var server = require('http').createServer(app);
var io = require('socket.io')(server);
server.listen(config.port, config.ip, function () {
console.log('Express server listening on %d, in %s mode', config.port,
app.get('env'));
});