diff --git a/lib/client.js b/lib/client.js index 7512d73..e3d12fc 100644 --- a/lib/client.js +++ b/lib/client.js @@ -204,6 +204,10 @@ BinaryClient.prototype._receiveStream = function(streamId){ }; BinaryClient.prototype.createStream = function(meta){ + if(this._socket.readyState !== WebSocket.OPEN) { + throw new Error('Client is not yet connected or has closed'); + return; + } var self = this; var streamId = this._nextId; this._nextId += 2;