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

Method subscribe

packages/server-e2e/src/client.ts:411–423  ·  view source on GitHub ↗

Send `subscribe` and await its ack. Tracks the session for `close()`.

(sid: string)

Source from the content-addressed store, hash-verified

409
410 /** Send `subscribe` and await its ack. Tracks the session for `close()`. */
411 async subscribe(sid: string): Promise<void> {
412 const ws = this._requireWs();
413 if (this._subscribed.has(sid)) return;
414 const id = `sub-${ulid()}`;
415 const ack = await ws.sendAndAwaitAck(
416 { type: 'subscribe', id, payload: { session_ids: [sid] } },
417 this._controlAckTimeoutMs,
418 );
419 if (ack.code !== 0) {
420 throw new Error(`subscribe rejected (code=${ack.code}): ${ack.msg ?? 'no message'}`);
421 }
422 this._subscribed.add(sid);
423 }
424
425 /** Send `unsubscribe` and await its ack. */
426 async unsubscribe(sid: string): Promise<void> {

Callers 11

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95

Calls 5

_requireWsMethod · 0.95
ulidFunction · 0.85
sendAndAwaitAckMethod · 0.80
hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected