Skip to content

Commit eb53ef6

Browse files
committed
Fixed bug on websocket client when trying to send queue even if socket is closing
1 parent b949637 commit eb53ef6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/env/browser/websocket.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ function websocket(dop, node, options) {
2525
send_queue.push(message);
2626
}
2727
function sendQueue() {
28-
while (send_queue.length>0)
29-
socket.send(send_queue.shift());
28+
if (socket.readyState===socket.constructor.OPEN)
29+
while (send_queue.length>0)
30+
socket.send(send_queue.shift());
3031
}
3132

3233
// Socket events

0 commit comments

Comments
 (0)