websocket icon indicating copy to clipboard operation
websocket copied to clipboard

ws_js: return c.closeErr when closed during read

Open joshuasing opened this issue 10 months ago • 2 comments

Return the close error when the WebSocket is closed (when running in WASM).

Previously, when the WebSocket connection is closed by the server, Read always returns net.ErrClosed, which prevents the correct handling of a close error with certain close status codes.

This might not be the best way to fix this, however we have been using this patch in production since June and it appears to resolve the issue and makes it possible to implement logic depending on the close code.

joshuasing avatar Dec 19 '24 17:12 joshuasing