You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to make the app disconnect and then start the reconnection processes when there is no access to our server (such as if there's no internet connection, or if the user is behind a firewall that prevents them from accessing the server).
We've implemented a ping, and when no response is received after a certain amount of time, we would like to disconnect and schedule reconnection, which would keep trying to reconnect until it gets a connection again.
We found that there are several ways we can do this. One of which is to call the disconnect() method inside the Connection class.
So something like this: xmppClient.disconnect().
It seems to work. Just not sure if this is okay or if there is a recommended way?
We were initially looking into directly calling the close callback of the socket (websocket/lib/Socket.js), but had some typescript problems (though that also works).
This also seems to work... but we occasionally get some errors which appear to be related to only briefly losing a connection:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We are trying to make the app disconnect and then start the reconnection processes when there is no access to our server (such as if there's no internet connection, or if the user is behind a firewall that prevents them from accessing the server).
We've implemented a ping, and when no response is received after a certain amount of time, we would like to disconnect and schedule reconnection, which would keep trying to reconnect until it gets a connection again.
We found that there are several ways we can do this. One of which is to call the
disconnect()
method inside theConnection
class.So something like this:
xmppClient.disconnect()
.It seems to work. Just not sure if this is okay or if there is a recommended way?
We were initially looking into directly calling the
close
callback of the socket (websocket/lib/Socket.js
), but had some typescript problems (though that also works).This also seems to work... but we occasionally get some errors which appear to be related to only briefly losing a connection:
Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions