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

Method onclose

lib/client.ts:317–333  ·  view source on GitHub ↗

* Called upon transport close. * * @param reason * @param description * @private

(
    reason: CloseReason | "forced server close",
    description?: any
  )

Source from the content-addressed store, hash-verified

315 * @private
316 */
317 private onclose(
318 reason: CloseReason | "forced server close",
319 description?: any
320 ): void {
321 debug("client close with reason %s", reason);
322
323 // ignore a potential subsequent `close` event
324 this.destroy();
325
326 // `nsps` and `sockets` are cleaned up seamlessly
327 for (const socket of this.sockets.values()) {
328 socket._onclose(reason, description);
329 }
330 this.sockets.clear();
331
332 this.decoder.destroy(); // clean up decoder
333 }
334
335 /**
336 * Cleans up event listeners.

Callers 1

closeMethod · 0.95

Calls 2

destroyMethod · 0.95
_oncloseMethod · 0.80

Tested by

no test coverage detected