diff --git a/src/http.ts b/src/http.ts index 840a9be..adf4252 100644 --- a/src/http.ts +++ b/src/http.ts @@ -91,6 +91,7 @@ async function pipeStream( bus?: Bus, name = '', streams?: Set<() => void>, ): Promise { 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 | undefined;