Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Callback function is called only once. #583

netkgk opened this Issue Nov 7, 2013 · 0 comments


None yet
2 participants

netkgk commented Nov 7, 2013

Callback function, when is set by emit, called only once, despite that many ack packages may appear. That's because it's deleted immediately after its first call in Socket.prototype.onack:

Socket.prototype.onack = function(packet){
  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]; // <- Callback is deleted here for some reason.
  } else {
    debug('bad ack %s', packet.id);

@rauchg rauchg closed this Nov 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment