我一直在尝试断开与命名空间甚至主套接字连接的联系,但一直失败。以下是我的代码:
服务器端:
socket.on('userDisconnect', function () {
socket.disconnect();
console.log("User Disconnected");
});
客户端:
// already connected to /world namespace
socket.emit('userDisconnect');
socket.disconnect();
socket = io.connect('http://something/india' );
我尝试从客户端和服务端断开连接,但没有成功。有人能指出错误吗?以下是socket.io输出到控制台的内容。
info - booting client
debug - websocket writing 0::/world
User Disconnected
debug - client authorized for /india
debug - websocket writing 1::/india
/world 是它试图断开连接的命名空间,然后它试图连接到 /india 命名空间。