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

Method onclose

packages/socket.io/lib/client.ts:323–339  ·  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

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

Callers 1

closeMethod · 0.95

Calls 3

destroyMethod · 0.95
debugFunction · 0.85
_oncloseMethod · 0.80

Tested by

no test coverage detected