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

Method _clearAcks

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

* Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from * the server. * * @private

()

Source from the content-addressed store, hash-verified

677 * @private
678 */
679 private _clearAcks() {
680 Object.keys(this.acks).forEach((id) => {
681 const isBuffered = this.sendBuffer.some(
682 (packet) => String(packet.id) === id,
683 );
684 if (!isBuffered) {
685 // note: handlers that do not accept an error as first argument are ignored here
686 const ack = this.acks[id];
687 delete this.acks[id];
688
689 if (ack.withError) {
690 ack.call(this, new Error("socket has been disconnected"));
691 }
692 }
693 });
694 }
695
696 /**
697 * Called with socket packet.

Callers 2

oncloseMethod · 0.95
socket.io.jsFile · 0.80

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected