node.js - Socket.io connection does not when i change my wifi network -


i using node.js + socket.io chat application. noticed when change wifi connection, socket stops working.

how can work?

here client side connection code

var socket = io.connect("https://website.com:8080", {             'reconnection delay': 500,              'reconnection limit': infinity,              'max reconnection attempts': infinity                }); 

you can use socket.io disconnect event make own reconnect:

var socket = connecttoserver(); function connecttoserver(){      var socket = io.connect("https://website.com:8080", {         'reconnection delay': 500,          'reconnection limit': infinity,          'max reconnection attempts': infinity       });      return socket;  }   socket.on('disconnect', function(){      socket.socket.connect();  }); 

: )


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c++ - libcurl curl_easy_setopt "Unknown error" -

vb6 - PostgreSQL ODBC Connection SSPI Authentication Failure -