()
| 268 | } |
| 269 | |
| 270 | close() { |
| 271 | this.cleanup() |
| 272 | |
| 273 | if (this.ws.readyState === WebSocket.OPEN) { |
| 274 | this.ws.close(1000, "Client closed connection") |
| 275 | } |
| 276 | |
| 277 | this.isConnected = false |
| 278 | } |
| 279 | |
| 280 | connect() { |
| 281 | const ws = new WebSocket(this.url) |