-
Notifications
You must be signed in to change notification settings - Fork 218
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
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.76% +1.92%
==========================================
Files 47 54 +7
Lines 4286 5381 +1095
Branches 611 692 +81
==========================================
+ Hits 3336 4292 +956
- Misses 933 1070 +137
- Partials 17 19 +2 ☔ 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. |
Sorry for delay @joshmossas mainly needed to test it. |
onClosed
from firing twice in EventStream
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