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

Feature request: don't reconnect in some cases, or allow manual connect #33

Open
alexgleason opened this issue Feb 25, 2024 · 0 comments

Comments

@alexgleason
Copy link

Problem: hundreds of WebSocket connections are kept open even if they aren't being used.

Why use backoff at all? Because this is part of a distributed system.

If the WebSocket connection dies, I only want it to reconnect if I have an active subscription open in my system. Then when a method is called and the socket is closed, it checks if it COULD be open (ie it's "eligible" to be opened according to the Backoff), and if so it reopens the connection at that time.

What I tried:

  • Custom Backoff class. It only exposes the millisecond delay, not whether or not it should reconnect.
  • Calling socket.close() manually (or setting closedByUser manually). There is no method to reopen it.

Now that I've typed this all out, it seems possible that you could close the socket manually while keeping the backoff and queue stored locally, and then recreate it with the same backoff and queue if you want to reopen. 🤔 But I'm not sure.

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

1 participant