Skip to content

Callback function is called only once. #583

@netkgk

Description

@netkgk

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);
  }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions