socket.io: disconnect event isn’t fired

Put your on disconnect code inside your on connect block and edit it a bit like so: io.sockets.on(‘connection’, function (socket) { count++; io.sockets.emit(‘count’, { number: count }); socket.on(‘disconnect’, function () { console.log(‘DISCONNESSO!!! ‘); count–; io.sockets.emit(‘count’, { number: count }); }); }); This way you’re detecting when a specific socket (specifically the socket you pass to … Read more

Socket.IO handling disconnect event

Ok, instead of identifying players by name track with sockets through which they have connected. You can have a implementation like Server var allClients = []; io.sockets.on(‘connection’, function(socket) { allClients.push(socket); socket.on(‘disconnect’, function() { console.log(‘Got disconnect!’); var i = allClients.indexOf(socket); allClients.splice(i, 1); }); }); Hope this will help you to think in another way

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed

In our network I have found that restarting the Workstation service on the client computer is able to resolve this problem. This has worked in cases where a reboot of the client would also fix the problem. But restarting the service is much quicker & easier [and may work when a reboot does not]. My … Read more

When restoring a backup, how do I disconnect all active connections?

You want to set your db to single user mode, do the restore, then set it back to multiuser: ALTER DATABASE YourDB SET SINGLE_USER WITH ROLLBACK AFTER 60 –this will give your current connections 60 seconds to complete –Do Actual Restore RESTORE DATABASE YourDB FROM DISK = ‘D:\BackUp\YourBaackUpFile.bak’ WITH MOVE ‘YourMDFLogicalName’ TO ‘D:\Data\YourMDFFile.mdf’, MOVE ‘YourLDFLogicalName’ … Read more