()
| 446 | } |
| 447 | |
| 448 | /*package*/ void close() { |
| 449 | logger.fine("disconnect"); |
| 450 | this.skipReconnect = true; |
| 451 | this.reconnecting = false; |
| 452 | if (this.readyState != ReadyState.OPEN) { |
| 453 | // `onclose` will not fire because |
| 454 | // an open event never happened |
| 455 | this.cleanup(); |
| 456 | } |
| 457 | this.backoff.reset(); |
| 458 | this.readyState = ReadyState.CLOSED; |
| 459 | if (this.engine != null) { |
| 460 | this.engine.close(); |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | private void onclose(String reason) { |
| 465 | logger.fine("onclose"); |