Check for connection state before sending flush character
This commit is contained in:
@ -4,7 +4,9 @@ CommandSocket = function(url, onOpen) {
|
||||
this.websocket.onopen = onOpen;
|
||||
this.websocket.onmessage = this.onMessage.bind(this);
|
||||
this.websocket.flush = function () {
|
||||
this.send('\n');
|
||||
if (this.readyState === this.OPEN) {
|
||||
this.send('\n');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user