Skip to content

Commit

Permalink
throw error if actions taken when not connected
Browse files Browse the repository at this point in the history
  • Loading branch information
ericz committed Jul 25, 2012
1 parent 52a755a commit c0cdb7b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/client.js
Expand Up @@ -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;
Expand Down

0 comments on commit c0cdb7b

Please sign in to comment.