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

Method disconnect

packages/socket.io-client/lib/socket.ts:899–913  ·  packages/socket.io-client/lib/socket.ts::Socket.disconnect

* Disconnects the socket manually. In that case, the socket will not try to reconnect. * * If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed. * * @example * const socket = io(); * * socket.on("disconnect", (reason) => {

()

Source from the content-addressed store, hash-verified

897 * @return self
898 */
899 public disconnect(): this {
900 if (this.connected) {
901 debug(class="st">"performing disconnect (%s)", this.nsp);
902 this.packet({ type: PacketType.DISCONNECT });
903 }
904
905 class="cm">// remove socket from pool
906 this.destroy();
907
908 if (this.connected) {
909 class="cm">// fire events
910 this.onclose(class="st">"io client disconnect");
911 }
912 return this;
913 }
914
915 /**
916 * Alias for {@link disconnect()}.

Callers 12

closeMethod · 0.95
index.tsFile · 0.45
index.tsFile · 0.45
socket.tsFile · 0.45
connection.tsFile · 0.45
setupManagerCallbacksFunction · 0.45
successFunction · 0.45
index.tsFile · 0.45
initFunction · 0.45
redis.tsFile · 0.45
disconnectSocketsMethod · 0.45
cluster-adapter.tsFile · 0.45

Calls 4

packetMethod · 0.95
destroyMethod · 0.95
oncloseMethod · 0.95
debugFunction · 0.85

Tested by

no test coverage detected