Skip to content

Commit

Permalink
Use same onack function like it is in the server code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsolt Lattmann committed Apr 2, 2015
1 parent 63cf9e7 commit 9115a5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ Socket.prototype.ack = function(id){
*/

Socket.prototype.onack = function(packet){
debug('calling ack %s with %j', packet.id, packet.data);
if (this.acks[packet.id]) {
var fn = this.acks[packet.id];
fn.apply(this, packet.data);
delete this.acks[packet.id];
} else {
// FIXME: is this an issue if the packet id does not exist in the acks?
}
var ack = this.acks[packet.id];
if ('function' == typeof ack) {
debug('calling ack %s with %j', packet.id, packet.data);
ack.apply(this, packet.data);
delete this.acks[packet.id];
} else {
debug('bad ack %s', packet.id);
}
};

/**
Expand Down
16 changes: 8 additions & 8 deletions socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -927,14 +927,14 @@ Socket.prototype.ack = function(id){
*/

Socket.prototype.onack = function(packet){
debug('calling ack %s with %j', packet.id, packet.data);
if (this.acks[packet.id]) {
var fn = this.acks[packet.id];
fn.apply(this, packet.data);
delete this.acks[packet.id];
} else {
// FIXME: is this an issue if the packet id does not exist in the acks?
}
var ack = this.acks[packet.id];
if ('function' == typeof ack) {
debug('calling ack %s with %j', packet.id, packet.data);
ack.apply(this, packet.data);
delete this.acks[packet.id];
} else {
debug('bad ack %s', packet.id);
}
};

/**
Expand Down

0 comments on commit 9115a5f

Please sign in to comment.