Open
Description
Hi there, I noticed in Firefox WASM calling CloseNow
returns an error:
A parameter or an operation is not supported by the underlying object
This can be fixed by instead calling Close(websocket.StatusNormalClosure, "some reason")
.
Since CloseNow
is just an alias for Close(websocket.StatusGoingAway, "")
my guess is that the empty reason value is being rejected by the browser,
Activity
mafredri commentedon Sep 6, 2024
@vito any chance you could try this change? Does it still produce the same error?
websocket/internal/wsjs/wsjs_js.go
Line 138 in a633a10
to:
vito commentedon Sep 8, 2024
@mafredri Tried that out - it actually doesn't seem like the empty reason is the issue, it seems to be the
websocket.StatusGoingAway
value.This works fine:
This returns the error:
Maybe that status code is reserved for the browser and it's not expected to be used programmatically?
Per the docs: