MCPcopy Index your code
hub / github.com/socketio/socket.io / ack

Method ack

lib/socket.ts:676–693  ·  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

674 * @private
675 */
676 private ack(id: number): () => void {
677 const self = this;
678 let sent = false;
679 return function () {
680 // prevent double callbacks
681 if (sent) return;
682 const args = Array.prototype.slice.call(arguments);
683 debug("sending ack %j", args);
684
685 self.packet({
686 id: id,
687 type: PacketType.ACK,
688 data: args,
689 });
690
691 sent = true;
692 };
693 }
694
695 /**
696 * Called upon ack packet.

Callers 1

oneventMethod · 0.95

Calls 1

packetMethod · 0.45

Tested by

no test coverage detected