* 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)
| 803 | * @return self |
| 804 | */ |
| 805 | public disconnect(close = false): this { |
| 806 | if (!this.connected) return this; |
| 807 | if (close) { |
| 808 | this.client._disconnect(); |
| 809 | } else { |
| 810 | this.packet({ type: PacketType.DISCONNECT }); |
| 811 | this._onclose("server namespace disconnect"); |
| 812 | } |
| 813 | return this; |
| 814 | } |
| 815 | |
| 816 | /** |
| 817 | * Sets the compress flag. |
no test coverage detected