This commit is contained in:
Drew DeVault 2015-07-30 15:37:13 +00:00
commit 2a78f80d1a
2 changed files with 2 additions and 1 deletions

View File

@ -175,7 +175,7 @@ function Websock() {
}
if (this._websocket.bufferedAmount < this.maxBufferedAmount) {
if (this._sQ.length > 0) {
if (this._sQ.length > 0 && this._websocket.readyState === WebSocket.OPEN) {
this._websocket.send(this._encode_message());
this._sQ = [];
}

View File

@ -180,6 +180,7 @@ describe('Websock', function() {
it('should actually send on the websocket if the websocket does not have too much buffered', function () {
sock.maxBufferedAmount = 10;
sock._websocket.bufferedAmount = 8;
sock._websocket.readyState = 1;
sock._sQ = [1, 2, 3];
var encoded = sock._encode_message();