Skip to content

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

Open
@masseelch

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions