(code: number, reason: string)
| 674 | } |
| 675 | |
| 676 | private onClose(code: number, reason: string): void { |
| 677 | if (this.closed) return; |
| 678 | this.closed = true; |
| 679 | if (this.pingTimer) clearInterval(this.pingTimer); |
| 680 | if (this.pongTimer) clearTimeout(this.pongTimer); |
| 681 | |
| 682 | this.sessionClients.forgetConnection(this); |
| 683 | this.subscriptions.clear(); |
| 684 | |
| 685 | if (this.fsWatchHandler !== undefined) { |
| 686 | try { |
| 687 | this.fsWatchHandler.cleanupConnection(this.id); |
| 688 | } catch (err) { |
| 689 | this.logger.warn( |
| 690 | { err: String(err) }, |
| 691 | 'fsWatchHandler.cleanupConnection threw', |
| 692 | ); |
| 693 | } |
| 694 | } |
| 695 | if (this.terminalHandler !== undefined) { |
| 696 | try { |
| 697 | this.terminalHandler.cleanupConnection(this.id); |
| 698 | } catch (err) { |
| 699 | this.logger.warn( |
| 700 | { err: String(err) }, |
| 701 | 'terminalHandler.cleanupConnection threw', |
| 702 | ); |
| 703 | } |
| 704 | } |
| 705 | this.logger.info({ code, reason, gotClientHello: this.gotClientHello }, 'connection closed'); |
| 706 | } |
| 707 | |
| 708 | public send(message: unknown): void { |
| 709 | if (this.closed) return; |
no test coverage detected