Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added missing Parser#error method

Restored previous sessionid generation mechanism temporarily
  • Loading branch information...
commit b57b00b9ffecaf6e6e06dca0656274966ce1f4d8 1 parent 9d19ae6
@rauchg rauchg authored
View
2  lib/socket.io/client.js
@@ -190,7 +190,7 @@ Client.prototype._queue = function(type, data){
};
Client.prototype._generateSessionId = function(){
- this.sessionId = ++this.listener._clientCount; // REFACTORME
+ this.sessionId = Math.random().toString().substr(2); // REFACTORME
return this;
};
View
8 lib/socket.io/transports/websocket.js
@@ -21,6 +21,7 @@ WebSocket.prototype._onConnect = function(req, socket){
this.parser = new Parser();
this.parser.on('data', self._onData.bind(this));
+ this.parser.on('error', self._onClose.bind(this));
Client.prototype._onConnect.call(this, req);
@@ -154,3 +155,10 @@ Parser.prototype.parse = function(){
}
}
};
+
+Parser.prototype.error = function(reason){
+ this.buffer = '';
+ this.i = 0;
+ this.emit('error', reason);
+ return this;
+};
Please sign in to comment.
Something went wrong with that request. Please try again.