Skip to content

wasm: Dial context timeout does not work sometimes #272

@nhooyr

Description

@nhooyr

Was reported to me by @TheDiscordian on reddit.

The problem is this line:

https://github.com/nhooyr/websocket/blob/c9f314abd11b749d43bb61fd214171f8bb4e4173/ws_js.go#L280

The close call will wait for the connection to open thus voiding the context timeout.

@TheDiscordian reported that putting the close into a new goroutine worked.
I think this is because we unbind the OnOpen listener when returning from dial and thus c.Close errors out instead of waiting for the connection to succeed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions