我无法弄清楚为什么多次断开/连接socket.io连接不起作用?
服务器端代码:
io.on('connection', function(socket){
console.log('a user connected');
socket.on('disconnect', function(){
console.log('user disconnected');
});
});
Run Code Online (Sandbox Code Playgroud)
客户端代码:
var socket = io();
socket.on('connect', function() {
console.log("connected from the client side");
});
$('#connect_button').click(function(){
socket.connect();
});
$('#disconnect_button').click(function(){
socket.disconnect();
});
Run Code Online (Sandbox Code Playgroud)
它断开连接.但不重新连接.我正在使用Socket.io 1.0.请帮忙.