Permalink
Browse files

Merge "support stream2 in node 0.10.x"

  • Loading branch information...
2 parents 8a7cf28 + fbdbb94 commit 17f003c2d8fdc6559b30021ffae496cc84243eb2 @xiecc xiecc committed with Gerrit Code Review Apr 1, 2013
Showing with 7 additions and 5 deletions.
  1. +0 −4 lib/common/service/localSessionService.js
  2. +7 −1 lib/connectors/hybrid/wsprocessor.js
@@ -268,10 +268,6 @@ LocalSession.prototype.export = function() {
return res;
};
-var rpcInvoke = function(app, sid, namespace, service, method, args, cb) {
- app.rpcInvoke(sid, {namespace: namespace, service: service, method: method, args: args}, cb);
-};
-
var localSessionCB = function(service, cb, err, sinfo) {
if(err) {
cb(err);
@@ -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() {

0 comments on commit 17f003c

Please sign in to comment.