-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sse): prevent onClosed from firing twice in EventStream #704
base: main
Are you sure you want to change the base?
Conversation
remove redundant `close()` invocation from examples/server-sent-events.ts
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #704 +/- ##
==========================================
+ Coverage 77.83% 79.73% +1.89%
==========================================
Files 47 53 +6
Lines 4286 5294 +1008
Branches 611 674 +63
==========================================
+ Hits 3336 4221 +885
- Misses 933 1055 +122
- Partials 17 18 +1 β View full report in Codecov by Sentry. |
@pi0 Just curious what was the reason you marked this PR as a draft. I just wanted to check and see if I needed to change something on my end. |
Fixes issue where
onClosed
always fires twice when using Server Sent Events.The following changes were made to fix the issue:
event.node.res.on('close')
hook inonClosed
methodThe following changes were made to related documentation:
eventStream.close()
invocation from./examples/server-sent-events.ts
eventStream.close()
invocation from./docs/1.guide/6.websockets.md
eventStream.close()
invocation from./tests/sse.test.ts
eventStream.close()
doesn't need to be called inonClosed
by default because it is automatically handled whenautoclose
is set to trueπ Linked issue
Fixes #703
β Type of change
π Description
π Checklist