Does anyone know why my socket connection does not close when using xhr-polling? This is the server code I would like to execute, but does not fire when using xhr-polling. The socket connection works fine ( I am running behind varnish with stunnel, since this a secure socket). I tried manually emitting a disconnect event on the browser unload, but this isnt an optimal solution for me.
client.on('disconnect', function () {
delete connected_clients[id];
console.log(' debug - ' + 'client ' + client.id + 'is disconnected');
console.log(' debug - ' + 'total number of connected clients is ' + Object.keys(connected_clients).length);
});
In my client side code, I am connecting the socket like this:
socket = io.connect(BASE_URL, {
"sync disconnect on unload":true
});
and my server side settings are this:
io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('log level', 3); // reduce logging
io.set('match origin protocol', true); // ssl support
io.set('sync disconnect on unload', true);
io.set('transports', [ // enable all transports (optional if you want flashsocket)
'xhr-polling',
'websocket',
'flashsocket',
'htmlfile',
'jsonp-polling'
]);
This is the debug message I get when the client exits the browser
debug: xhr-polling closed due to exceeded duration
I am using socket.io version 0.9.10 with node 0.8.8.