Open sinedied opened 1 year ago
Ok after digging into your source code, I found the solution: after the individual reply.sse()
are completed, you need to call reply.sseContext.source.end()
to end the stream.
This probably should be in the readme docs, took me a while to figure it out.
Thank you for PR, i will keep this issue open, to solve it more elegantly when I catch some time^^
When trying your examples with fastify@4.0.0, only the async iterable one ever completes.
The exemples with individual events works for sending events, but the connection is kept open and never closes. Is there something I missed? Should I close the connection manually from the server? If so, how to do it?
I put up an example repo to illustrate this: https://github.com/sinedied/fastify-sse-test/blob/main/src/routes/test/index.ts
After running the server, run these URLs in a browser: