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

Method ack

packages/socket.io-client/lib/socket.ts:785–800  ·  view source on GitHub ↗

* Produces an ack callback to emit with an event. * * @private

(id: number)

Source from the content-addressed store, hash-verified

783 * @private
784 */
785 private ack(id: number): (...args: any[]) => void {
786 const self = this;
787 let sent = false;
788 return function (...args: any[]) {
789 // prevent double callbacks
790 if (sent) return;
791 sent = true;
792 debug("sending ack %j", args);
793
794 self.packet({
795 type: PacketType.ACK,
796 id: id,
797 data: args,
798 });
799 };
800 }
801
802 /**
803 * Called upon a server acknowledgement.

Callers 2

oneventMethod · 0.95
onResponseFunction · 0.45

Calls 2

debugFunction · 0.85
packetMethod · 0.45

Tested by

no test coverage detected