disconnect
一度呼び出されたソケットioに再接続するにはどうすればよいですか?
これがコードです
function initSocket(__bool){
if(__bool == true){
socket = io.connect('http://xxx.xxx.xxx.xxx:8081', {secure:false});
socket.on('connect', function(){console.log('connected')});
socket.on('disconnect', function (){console.log('disconnected')});
}else{
socket.disconnect();
socket = null;
}
}
私がそうするならばinitSocket(true)
、それは働きます。私がそうするinitSocket(false)
と、それは切断されます。しかし、を使用して再接続しようとするとinitSocket(true)
、接続が機能しなくなります。接続を機能させるにはどうすればよいですか?