MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / readWithTimeout

Function readWithTimeout

test/server/streamableHttp.test.ts:1510–1521  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1508
1509 // Read chunks until we have all 3 notifications or timeout
1510 const readWithTimeout = async () => {
1511 const timeout = setTimeout(() => reconnectReader!.cancel(), 2000);
1512 try {
1513 while (!allText.includes('Missed notification 3')) {
1514 const { value, done } = await reconnectReader!.read();
1515 if (done) break;
1516 allText += new TextDecoder().decode(value);
1517 }
1518 } finally {
1519 clearTimeout(timeout);
1520 }
1521 };
1522 await readWithTimeout();
1523
1524 // Verify we received ALL notifications that were sent while disconnected

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…