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

Function receive

packages/server/test/fs-watch.e2e.test.ts:175–192  ·  view source on GitHub ↗
(conn: Conn, timeoutMs: number)

Source from the content-addressed store, hash-verified

173}
174
175function receive(conn: Conn, timeoutMs: number): Promise<WsFrame> {
176 return new Promise((resolve, reject) => {
177 if (conn.queue.length > 0) {
178 resolve(conn.queue.shift()!);
179 return;
180 }
181 const t = setTimeout(() => {
182 const idx = conn.waiters.indexOf(waiter);
183 if (idx >= 0) conn.waiters.splice(idx, 1);
184 reject(new Error(`no message in ${timeoutMs}ms`));
185 }, timeoutMs);
186 const waiter = (frame: WsFrame): void => {
187 clearTimeout(t);
188 resolve(frame);
189 };
190 conn.waiters.push(waiter);
191 });
192}
193
194async function receiveType(
195 conn: Conn,

Callers 2

receiveTypeFunction · 0.70

Calls 3

rejectFunction · 0.85
resolveFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected