Skip to content

Commit a619aba

Browse files
Websocket.send() does not support callbacks (#305)
1 parent ffc54dc commit a619aba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/transports/websocket.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ module.exports = class Connection extends EventEmitter {
3131
this.debugOut('writeLine() socket=' + (this.socket ? 'yes' : 'no') + ' connected=' + this.connected);
3232

3333
if (this.socket && this.connected) {
34-
this.socket.send(line, cb);
35-
} else if (cb) {
34+
this.socket.send(line);
35+
}
36+
37+
// Websocket.send() does not support callbacks
38+
// call the callback in the next tick instead
39+
if (cb) {
3640
setTimeout(cb, 0);
3741
}
3842
}

0 commit comments

Comments
 (0)