nitro
nitro copied to clipboard
SSE: Unnoticed close when used with Nitro HMR
Environment
h3 1.11.1 bun 1.1.3
Reproduction
https://stackblitz.com/edit/github-b7ffrj?file=server%2Fapi%2Fevents.ts
All output is in your browsers devtools.
The reproduction provides an SSE endpoint (/api/events
) simply sending events once a second.
The clients app.vue
connects to that endpoint, printing out received messages, and additionally a connection status once a second.
To trigger the issue: Add an empty line at the end of the server handler, save the file (to trigger the HMR actions) and observe no more events coming in while the connection is still reported as OPEN
.
Describe the bug
An HMR event (such as a change to a server eventHandler handling a SSE connection) kills any open SSE connection without further notice.
I can't tell if this is an issue by h3, nuxt or vueuse (providing the client composable).
Additional context
No response
Logs
No response