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

Function helloAndSubscribe

packages/server/test/ws-broadcast.e2e.test.ts:153–163  ·  view source on GitHub ↗

* Send a client_hello + subscribe to one session. Drains the resulting * `ack` so subsequent `receiveType(conn, ...)` calls see only event frames.

(conn: Conn, clientId: string, sessionId: string)

Source from the content-addressed store, hash-verified

151 * `ack` so subsequent `receiveType(conn, ...)` calls see only event frames.
152 */
153async function helloAndSubscribe(conn: Conn, clientId: string, sessionId: string): Promise<void> {
154 await receiveType(conn, 'server_hello', 1000);
155 conn.ws.send(
156 JSON.stringify({
157 type: 'client_hello',
158 id: `cli_${clientId}`,
159 payload: { client_id: clientId, subscriptions: [sessionId] },
160 }),
161 );
162 await receiveType(conn, 'ack', 1000);
163}
164
165describe('WS broadcast + per-session seq (W5.2)', () => {
166 it('two subscribers both receive seq=1 then seq=2 for the same session', async () => {

Callers 1

Calls 2

receiveTypeFunction · 0.70
sendMethod · 0.65

Tested by

no test coverage detected