* Disconnect socket
()
| 116 | * Disconnect socket |
| 117 | */ |
| 118 | disconnect() { |
| 119 | if (this.socket) { |
| 120 | // Remove all listeners |
| 121 | this.listeners.forEach((handler, event) => { |
| 122 | this.socket.off(event, handler); |
| 123 | }); |
| 124 | this.listeners.clear(); |
| 125 | this.conversationRooms.clear(); |
| 126 | |
| 127 | this.socket.disconnect(); |
| 128 | this.socket = null; |
| 129 | this.isAuthenticated = false; |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Join a conversation room |
no test coverage detected