* Closes the WebSocket connection.
()
| 157 | * Closes the WebSocket connection. |
| 158 | */ |
| 159 | async close(): Promise<void> { |
| 160 | if ( |
| 161 | this.ws.readyState === WS_OPEN || |
| 162 | this.ws.readyState === WS_CONNECTING |
| 163 | ) { |
| 164 | this.ws.close() |
| 165 | } |
| 166 | // Ensure listeners are removed even if close was called externally or connection was already closed |
| 167 | this.handleCloseCleanup() |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * Sends a JSON-RPC message over the WebSocket connection. |
no test coverage detected