You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SSE connection closes when server uses await operations
Description
I've encountered a behavior when using sse.js in conjunction with async/await patterns on my express server side. The connection consistently triggering the 'close' event whenever the server executes an await operation. The issue is that the client can't close itself the connection because the 'close' event of the server has already been called. This lead to an unexpected behavior where the server continue its execution even if the client don't want to.
The same server code works perfectly with the native EventSource implementation. The connection remains open when using await operations, suggesting this might be related to sse.js.
Potential Lead
I checked with wireshark to know who was closing the connection and it seems that nobody "close" it, in the sense that nobody send [FIN]. However, the server send a 200 OK [Last Chunk] when the await is called, suggesting that the issue comes from the server. Claude suggested that it's because the XHR 'load' event is triggered prematurely but I don't know what it's worth.
The text was updated successfully, but these errors were encountered:
SSE connection closes when server uses await operations
Description
I've encountered a behavior when using sse.js in conjunction with async/await patterns on my express server side. The connection consistently triggering the 'close' event whenever the server executes an await operation. The issue is that the client can't close itself the connection because the 'close' event of the server has already been called. This lead to an unexpected behavior where the server continue its execution even if the client don't want to.
Reproduction
Server code demonstrating the issue:
Client code:
Event Source
The same server code works perfectly with the native EventSource implementation. The connection remains open when using await operations, suggesting this might be related to sse.js.
Potential Lead
I checked with wireshark to know who was closing the connection and it seems that nobody "close" it, in the sense that nobody send [FIN]. However, the server send a 200 OK [Last Chunk] when the await is called, suggesting that the issue comes from the server. Claude suggested that it's because the XHR 'load' event is triggered prematurely but I don't know what it's worth.
The text was updated successfully, but these errors were encountered: