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

Method clearTransport

packages/engine.io/lib/socket.ts:387–406  ·  view source on GitHub ↗

* Clears listeners and timers associated with current transport. * * @private

()

Source from the content-addressed store, hash-verified

385 * @private
386 */
387 private clearTransport() {
388 let cleanup;
389
390 const toCleanUp = this.cleanupFn.length;
391
392 for (let i = 0; i < toCleanUp; i++) {
393 cleanup = this.cleanupFn.shift();
394 cleanup();
395 }
396
397 // silence further transport errors and prevent uncaught exceptions
398 this.transport.on("error", function () {
399 debug("error triggered by discarded transport");
400 });
401
402 // ensure transport won't stay open
403 this.transport.close();
404
405 clearTimeout(this.pingTimeoutTimer);
406 }
407
408 /**
409 * Called upon transport considered closed.

Callers 2

onPacketMethod · 0.95
onCloseMethod · 0.95

Calls 4

cleanupFunction · 0.85
debugFunction · 0.85
onMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected