We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a6d4af commit 22c4c59Copy full SHA for 22c4c59
src/internal/browser/browser-channel.js
@@ -134,7 +134,17 @@ export default class WebSocketChannel {
134
if (this._pending !== null) {
135
this._pending.push(buffer)
136
} else if (buffer instanceof HeapBuffer) {
137
- this._ws.send(buffer._buffer)
+ try {
138
+ this._ws.send(buffer._buffer)
139
+ } catch (error) {
140
+ if (this._ws.readyState !== WS_OPEN) {
141
+ // Websocket has been closed
142
+ this._handleConnectionError()
143
+ } else {
144
+ // Some other error occured
145
+ throw error
146
+ }
147
148
} else {
149
throw newError("Don't know how to send buffer: " + buffer)
150
}
0 commit comments