Can someone tell me how to get disconnect event with socket.io
with xhr-polling
in node.js
please?
This example not working with xhr-polling
but works with websockets
..
/* 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']); // If I change it to websockets it works!
// routing
app.get('/', function (req, res) {
res.sendfile("index.html");
app.use(express.static(__dirname));
});
var online_clients = 0;
io.sockets.on('connection', function (socket) {
socket.on('disconnect', function() {
console.log("SOMEONE LEFT");
});
});
So how to get disconnect event with xhr-pooling
?