Skip to content

Commit 3dd4ff1

Browse files
committed
fix hanging issue
1 parent 5c5a330 commit 3dd4ff1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/server/streamableHttp.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ export class StreamableHTTPServerTransport implements Transport {
162162
}));
163163
return;
164164
}
165-
166-
res.writeHead(200, headers);
165+
// We need to send headers immediately as message will arrive much later,
166+
// otherwise the client will just wait for the first message
167+
res.writeHead(200, headers).flushHeaders();
167168

168169
// Store the response for this request so we can use it for standalone server notifications
169170
// This response doesn't have an associated request ID, so we'll use a special string to track it

0 commit comments

Comments
 (0)