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

reconnect attempts only when ... #72

Open
mschipperheyn opened this issue Jun 10, 2016 · 5 comments
Open

reconnect attempts only when ... #72

mschipperheyn opened this issue Jun 10, 2016 · 5 comments

Comments

@mschipperheyn
Copy link

In a mobile scenario, often the internet connection is not available. In that case it doesn't seem to make sense, and I wouldn't be surprised if it was detrimental to battery life, to keep trying to reconnect.

It might be interesting to add a function reference that returns a boolean on whether to attempt a reconnect at all. This function could in a mobile scenario return true if connected and false if offline.

@aparmar
Copy link

aparmar commented Aug 24, 2016

One of the interesting ways to do this is to have a variable timer. Start with 2s, if it doesnt reconnect go to 4, then 8 etc. Have an option to have a max time (E.g 3-5 mins). Once reconnected, the next reconnect timer (if disconnected) would start again at 2s. This should reduce drain on battery (it would be 20 polls at max time of 3 mins, as opposed to 1800 polls at a max time of 2s).

Looks like the author added "reconnectDecay", which should let you do this.

@mschipperheyn
Copy link
Author

I have implemented this based on an adapted version of a reconnection library. I can send this if ibterestibg. Only thing g I still need to do is deal with expired server sessions against a websocket that is still alive.

@nathanboktae
Copy link

robust-websocket allows you to fully configure when to reconnect via a function callback

@aparmar
Copy link

aparmar commented Oct 14, 2016

@nathanboktae I like the premise of where you are going with robust-websocket. However, can I suggest that we improve reconnecting-websocket to include tests and other things that you deem are missing? This project already has 1k+ followers. So rather than fork the userbase, I suggest adding to and improving this project.

-Amar

@nathanboktae
Copy link

I considered that @aparmar but there's too many issues with this library on fundamental levels that I started a new project fresh, especially with 0 tests. I have no idea how the library truly works without tests and contracts being validated constantly, and evidence to the users of that package that they are. Also, the maintainer seems not so active these days.

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

3 participants