MCPcopy
hub / github.com/socketio/socket.io / ack

Method ack

packages/socket.io/lib/socket.ts:583–600  ·  view source on GitHub ↗

* Produces an ack callback to emit with an event. * * @param {Number} id - packet id * @private

(id: number)

Source from the content-addressed store, hash-verified

581 * @private
582 */
583 private ack(id: number): () => void {
584 const self = this;
585 let sent = false;
586 return function () {
587 // prevent double callbacks
588 if (sent) return;
589 const args = Array.prototype.slice.call(arguments);
590 debug("sending ack %j", args);
591
592 self.packet({
593 id: id,
594 type: PacketType.ACK,
595 data: args,
596 });
597
598 sent = true;
599 };
600 }
601
602 /**
603 * Called upon ack packet.

Callers 1

oneventMethod · 0.95

Calls 2

debugFunction · 0.85
packetMethod · 0.45

Tested by

no test coverage detected