You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
sinedied
added a commit
to sinedied/fastify-sse-v2
that referenced
this issue
Jul 28, 2023
sinedied
changed the title
SSE connection never closer when not using async iterable
SSE connection never close when not using async iterable
Sep 19, 2023
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:
The text was updated successfully, but these errors were encountered: