LearnBoost/socket.io — Issue #718: memory leak?
Author: crickeys
Created: 2012-01-12 01:25:37+00:00
State: open

The following code creates a cyclic assertion. Should it??

var assertvanish = require('assertvanish');
io.sockets.on('connection', function (socket) {
// setup listeners for this socket
setup_socket_events(socket);
});

function setup_socket_events(socket)
{
socket.on('disconnect', event_disconnect(socket) );
// do more things...
}
function event_disconnect(socket)
{

return function() {
console.log("disconnect");
// do something with socket
assertvanish(socket, 5000);
}
}