-
Notifications
You must be signed in to change notification settings - Fork 258
eventStream.push
hangs when called before eventStream.send()
#944
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
Labels
bug
Something isn't working
Comments
eventStream.push
hangs when called multiple times before eventStream.send()
eventStream.push
hangs when called before eventStream.send()
Thanks |
@rrd108 do something? |
I solved it using the package you reccomended here #940 (comment) |
Here's an example for Server-Sent Events (SSE): https://h3.dev/guide/websocket#example In short, avoid blocking In your example, you can simply do the following: (async () => {
console.log('before eventStream.push()')
for (const message of messages) {
console.log('before eventStream.push()')
await eventStream.push(message)
console.log('after eventStream.push()')
}
console.log('👉 NOW YOU GET HERE')
await eventStream.close()
})()
// Do not block this
return eventStream.send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
node v20.13.0
h3: 1.13.0
Reproduction
https://github.com/rrd108/h3-eventstream-push-hang
Steps to reproduce:
Describe the bug
The
eventStream.push
method in h3 hangs indefinitely when called before theeventStream.send()
method is invoked.This prevents the server from sending the stream to the client and causes a stall. The issue occurs even with a single call to
eventStream.push
beforesend
and it is not related to backpressure.The
WritableStream
reports it'sready
before thepush
, and the problem is present even if we await the ready promise before the write operation.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: