* Disconnects this client. * * @example * io.on("connection", (socket) => { * // disconnect this socket (the connection might be kept alive for other namespaces) * socket.disconnect(); * * // disconnect this socket and close the underlying connection * socket.disconne
(close = false)
| 710 | * @return self |
| 711 | */ |
| 712 | public disconnect(close = false): this { |
| 713 | if (!this.connected) return this; |
| 714 | if (close) { |
| 715 | this.client._disconnect(); |
| 716 | } else { |
| 717 | this.packet({ type: PacketType.DISCONNECT }); |
| 718 | this._onclose(class="st">"server namespace disconnect"); |
| 719 | } |
| 720 | return this; |
| 721 | } |
| 722 | |
| 723 | /** |
| 724 | * Sets the compress flag. |
no test coverage detected