socket: turn acks into an object

This commit is contained in:
Guillermo Rauch
2012-12-13 08:51:16 -03:00
parent 60a17801f9
commit 0ce8934eed

View File

@@ -45,7 +45,7 @@ function Socket(io, nsp){
this.nsp = nsp;
this.json = this; // compat
this.ids = 0;
this.acks = [];
this.acks = {};
this.open();
}
@@ -104,8 +104,8 @@ Socket.prototype.emit = function(ev){
// event ack callback
if ('function' == typeof args[args.length - 1]) {
debug('emitting packet with ack id %d', this.ids);
this.acks[this.ids] = args.pop();
packet.id = this.ids++;
this.acks.push(args.pop());
}
packet.args = args;