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

Method startPingTimer

packages/server/src/ws/connection.ts:649–667  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

647 }
648
649 private startPingTimer(): void {
650 this.pingTimer = setInterval(() => {
651 if (this.closed) return;
652 this.send(buildPing());
653
654 if (this.pongTimer) clearTimeout(this.pongTimer);
655 this.pongTimer = setTimeout(() => {
656 if (this.closed) return;
657 this.logger.warn('pong timeout — terminating socket');
658 try {
659 this.socket.terminate();
660 } catch {
661
662 }
663 }, this.pongTimeoutMs);
664 this.pongTimer.unref?.();
665 }, this.pingIntervalMs);
666 this.pingTimer.unref?.();
667 }
668
669 private onPong(): void {
670 if (this.pongTimer) {

Callers 1

constructorMethod · 0.95

Calls 3

sendMethod · 0.95
buildPingFunction · 0.90
warnMethod · 0.65

Tested by

no test coverage detected