Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on internet reconnect, centriguge-js take approx 1 min for reconnection to centrifuge server #203

Closed
paliwalsam opened this issue Oct 8, 2022 · 6 comments

Comments

@paliwalsam
Copy link

paliwalsam commented Oct 8, 2022

Hii,

when client internet connection change, centriguge-js take approx 1 min for reconnection to centrifuge server,

i am using websocket transport system,following configuration does not provide any help
minReconnectDelay:50,
maxReconnectDelay:100,
maxServerPingDelay:100,

@FZambia
Copy link
Member

FZambia commented Oct 8, 2022

Hello, It can take up to 35 secs in default configuration (25 secs for ping wait, additional 10 secs coming from default maxPingDelay), can you provide steps to reproduce 1 min?

Also, please describe which environment and client/server versions you are using? As I am talking about latest versions while you could use old version of centrifuge-js and Centrifugo/Centrifuge.

As a workaround for a long time to reconnect it's possible to use online/offline events https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine - and disconnect/connect upon receiving them.

Seems we should rely on those events in centrifuge-js too to force faster reconnect on going online.

@paliwalsam
Copy link
Author

server : ubuntu 20.04
centrifuge server: 4.0.1
centrifuge JS client: 3.0.1
chrome Version 105.0.5195.125 (Official Build) (arm64)
after implementation following:

function reconnect()
{
centrifuge.disconnect();
centrifuge.connect();
}

window.addEventListener('offline', (e) => { console.log('offline'); });
window.addEventListener('online', (e) => { console.log('online');reconnect(); });

after above implementation, no luck

@FZambia
Copy link
Member

FZambia commented Oct 8, 2022

can you provide steps to reproduce 1 min?

Still actual

@FZambia
Copy link
Member

FZambia commented Oct 8, 2022

window.addEventListener('offline', (e) => { console.log('offline'); });
window.addEventListener('online', (e) => { console.log('online');reconnect(); });

after above implementation, no luck

Tried this locally – this causes reconnect for me upon getting online event, what's exactly going on in your case? Why no luck? Please try providing as much of the context as you can - no luck does not describe anything.

@FZambia
Copy link
Member

FZambia commented Oct 13, 2022

@paliwalsam hello, I believe that #204 should make things much better, but I still confused why it did not help in your case.

@FZambia
Copy link
Member

FZambia commented Dec 14, 2022

#204 is a part of centrifuge-js 3.1.0

@FZambia FZambia closed this as completed Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants