Skip to content

Better approach #57

Open
Open
@0x366

Description

@0x366

Was playing around with this lib trying to have a fault tolerant ws connection. Tried patches from different prs and forks, still there was a present problem with race - multiple reconnects occurring from time to time. Also making a custom heartbeat is a headache.

And realised, why not just wrap the ws listener in infinite cycle?

	for {
		select {
		case <-ctx.Done():
			return
		default:
			err := InitAndListenWs()
			if err != nil {
				....
			}
		}
	}

No concurrency problems and easy to implement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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