In socket.io the disconnect event doesn't fire when the transport xhr-polling is active. If I switch the transport to websockets it works fine, but in xhr-polling its doesn't work.
/* Basics */
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
server.listen(1337, null);
io.set('transports', ['xhr-polling']);
// routing
app.get('/', function (req, res) {
res.sendfile("index.html");
app.use(express.static(__dirname));
});
io.sockets.on('connection', function (socket)
socket.on('disconnect', function() {
console.log('LOL');
});
});
In the following code the disconnect doesn't fire, but if I delete the line -
io.set('transports', ['xhr-polling']);
It works perfectly, so why it doesn't work with xhr-polling? but only with websockets?
How can I fix this? Am I missing something?
Thanks in Advance ;)