How to properly terminate H3 EventHandler when using Server-Sent Events? #2996
Unanswered
vicentematus
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working with Server-Sent Events (SSE) in Nitro (behind it's h3). I've encountered an issue where the server continues processing the event handler even after the client disconnects and the
onClosed
callback is triggered.When a client disconnects from the SSE connection, the
onClosed
callback triggers as expected. However, the issue is that the EventHandler continues executing. This means that even though we've closed the client connection, our server is still processing data.See my following code:
What's the recommended approach to terminate the entire EventHandler execution when a client disconnects? Or I'm approaching server-side events the correct way?
Im using
node v20.15.1
nitropack: 2.9.7([email protected])
[email protected]
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions