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

[proposal] Method to wait for re-connect after connection loss #40

Open
masseelch opened this issue Jun 10, 2021 · 1 comment
Open

[proposal] Method to wait for re-connect after connection loss #40

masseelch opened this issue Jun 10, 2021 · 1 comment

Comments

@masseelch
Copy link

Currently I do it this way, but find it rather unclean:

for {
  if !ws.IsConnected() {
    time.Sleep(time.Second * 2)
    continue
  }

  // Do stuff with connection
}

One idea I have is to export the getBackoff() method to wait for the correct time until trying to read a new message. Another idea is to have a method WaitConnection() / EnsureConnection(), which blocks until the connection is reestablished. I am happy to create a PR for either of the proposals.

@masseelch masseelch changed the title [proposal] Is there a way to wait for the connection to be reestablished in case of connection loss? [proposal] Method to wait for re-connect after connection loss. Jun 10, 2021
@masseelch masseelch changed the title [proposal] Method to wait for re-connect after connection loss. [proposal] Method to wait for re-connect after connection loss Jun 10, 2021
@masseelch
Copy link
Author

Is this repo still maintained?

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