Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
support stream2 in node 0.10.x
Browse files Browse the repository at this point in the history
Change-Id: Ie47efba45258ce211d3d7ccff774e34d5436b351
  • Loading branch information
changchang committed Apr 1, 2013
1 parent 1459522 commit fbdbb94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/connectors/hybrid/wsprocessor.js
Expand Up @@ -32,7 +32,13 @@ Processor.prototype.add = function(socket, data) {
return;
}
this.httpServer.emit('connection', socket);
socket.emit('data', data);
if(typeof socket.ondata === 'function') {
// compatible with stream2
socket.ondata(data, 0, data.length);
} else {
// compatible with old stream
socket.emit('data', data);
}
};

Processor.prototype.close = function() {
Expand Down

0 comments on commit fbdbb94

Please sign in to comment.