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
Post a Comment