Permalink
Browse files

socket transport methods refactored a little bit, fixed error in sock…

…et client lib
  • Loading branch information...
1 parent 02d4784 commit f7b97e2c00baa45dccc495fca9462180a6c399c8 @dimsmol committed Feb 7, 2013
Showing with 7 additions and 7 deletions.
  1. +3 −3 client/src/apis/socket.js
  2. +4 −4 lib/mechanics/socket/transport.js
@@ -132,10 +132,10 @@ Socket.prototype.close = function () {
}
};
-Socket.prototype.send = function (path, method, headers, body, opt_options, opt_cb) {
+Socket.prototype.send = function (path, method, headers, data, opt_options, opt_cb) {
var self = this;
this.connect(function () {
- self.sendInternal(path, method, headers, body, opt_options, opt_cb);
+ self.sendInternal(path, method, headers, data, opt_options, opt_cb);
});
};
@@ -156,7 +156,7 @@ Socket.prototype.sendInternal = function (path, method, headers, data, opt_optio
body = '';
}
else {
- body = JSON.stringify(body);
+ body = JSON.stringify(data);
}
var msg = [
@@ -50,12 +50,12 @@ Transport.prototype.encode = function(headers, data) {
].join(this.headersSeparator);
};
-Transport.prototype.sendSingleMessage = function (connection, message) {
+Transport.prototype.send = function (connection, message) {
connection.write(message);
this.emit('message_sent', connection, message);
};
-Transport.prototype.send = function(recipientConnections, data, opt_connectionsToExclude) {
+Transport.prototype.sendMultiple = function(recipientConnections, data, opt_connectionsToExclude) {
if (recipientConnections == null || recipientConnections.length === 0) {
return;
}
@@ -65,7 +65,7 @@ Transport.prototype.send = function(recipientConnections, data, opt_connectionsT
for (var k in recipientConnections) {
if (!opt_connectionsToExclude || !(k in opt_connectionsToExclude)) {
var connection = recipientConnections[k];
- this.sendSingleMessage(connection, message);
+ this.send(connection, message);
}
}
};
@@ -81,7 +81,7 @@ Transport.prototype.sendResult = function(req, res, result) {
}
var message = this.encode(headers, result);
- this.sendSingleMessage(req.connection, message);
+ this.send(req.connection, message);
};

0 comments on commit f7b97e2

Please sign in to comment.