Socket.IO处理断开事件
无法处理此断开事件,不知道为什么套接字未发送给客户端/客户端没有响应! 服务器 io.sockets.on('connection', function (socket) { socket.on('NewPlayer', function(data1) { online = online + 1; console.log('Online players : ' + online); console.log('New player connected : ' + data1); Players[data1] = data1; console.log(Players); }); socket.on('DelPlayer', function(data) { delete Players[data]; console.log(Players); console.log('Adios' + data); }); socket.on('disconnect', function () { socket.emit('disconnected'); online = online …