MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / onClose

Method onClose

packages/server/src/ws/connection.ts:676–706  ·  view source on GitHub ↗
(code: number, reason: string)

Source from the content-addressed store, hash-verified

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;

Callers 6

constructorMethod · 0.95
closeMethod · 0.80
handleInputMethod · 0.80
handleInputMethod · 0.80
handleInputMethod · 0.80
handleInputMethod · 0.80

Calls 5

forgetConnectionMethod · 0.65
clearMethod · 0.65
cleanupConnectionMethod · 0.65
warnMethod · 0.65
infoMethod · 0.65

Tested by

no test coverage detected