fix(http): flush SSE headers immediately so idle subscriptions don't deadlock clients

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-06-28 13:37:33 -05:00
1 parent 8335ff2875
commit 0c29c76a8a
1 file changed
+1
+1
View File
@@ -91,6 +91,7 @@ async function pipeStream(
bus?: Bus, name = '', streams?: Set<() => void>,
): Promise<void> {
res.writeHead(200, encoder.headers);
res.flushHeaders(); // establish the stream immediately so idle-until-event sources (e.g. subscriptions) don't deadlock clients awaiting headers
bus?.emit('stream:open', { name });
const it = stream[Symbol.asyncIterator]();
let ping: ReturnType<typeof setInterval> | undefined;