ack method

Function ack(
  1. dynamic id
)

Produces an ack callback to emit with an event.

@param {Number} packet id @api private

Implementation

Function ack(id) {
  var sent = false;
  return (_) {
    // prevent double callbacks
    if (sent) return;
    var type = ackValue;
    packet(<dynamic, dynamic>{
      'id': id,
      'type': type,
      'data': [_]
    });
    sent = true;
  };
}