Replies: 2 comments
-
Hi! I think you can either:
This is the upper bound for the exponential reconnection delay. Reference: https://socket.io/docs/v4/client-options/#reconnectiondelaymax
window.addEventListener('focus', () => {
socket.connect();
}); Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event |
Beta Was this translation helpful? Give feedback.
-
Thank, I set reconnectionDelayMax to 3000. I just noticed on my iPhone (Safari) that it reconnected quickly (between 1 and 3 seconds) but on my Samsung Android (Chrome) it was a little longer, sometimes 5 or 10 or 15 seconds. Maybe JavaScript is still frozen (stopped) on Android as soon as the phone boots up, the login call is done before JavaScript is unblocked/unfreezed from the browser or something like that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
On an Android mobile, I checked "Energy saving" in the options. I noticed that getting I disconnected very quickly from socket.io in 2 methods:
I'm looking for a way to reconnect as soon as possible to socket.io
I noticed that by putting a popup in 'disconnect' (equivalent to alert() ) I noticed that this popup is displayed as soon as I display my application, which means that the "on disconnect" is detected immediately, I'm looking for a way to automatically reconnect to the application as quickly as possible, if possible in 1 second, but I can't.
Instead it reconnects to socket.io about 10 even 30 seconds later.
Anyone know what's wrong with my app?
Here is my structure:
Cdt
Beta Was this translation helpful? Give feedback.
All reactions