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
I've been experimenting with various SSE libraries for my Angular app and found eventsource to be the most stable. However, I've encountered an issue where the stream sometimes gets cut off after re-initializing it.
Here's the scenario: when the dropdown value changes, a new stream is initialized with new parameters. Unfortunately, frequently changing the dropdown values often causes the stream to get stuck after fetching a few bytes of data. After about 45 seconds it returns error ERR_HTTP2_PROTOCOL_ERROR 200 (OK), the stream reinitializes and then works fine.
I initially suspected that Nginx might be the cause since it works perfectly fine locally. However, when I tried another library, event-source-polyfill, I couldn't reproduce the issue.
Has anyone else experienced something similar? I'll paste my code here for reference.
The text was updated successfully, but these errors were encountered:
usmdt
changed the title
SSE connection is being cut with error - ERR_HTTP2_PROTOCOL_ERROR 200 (OK)
SSE connection is being cut off with error - ERR_HTTP2_PROTOCOL_ERROR 200 (OK)
Feb 13, 2025
It uses the browsers' fetch implementation by default - I'd be curious to hear if you get the same error if you just do a fetch call to the same endpoint?
asyncfunctionfetchAndStream(url){constresponse=awaitfetch(url);if(!response.body){console.error("Readable stream not supported");return;}constreader=response.body.getReader();constdecoder=newTextDecoder();while(true){const{ done, value }=awaitreader.read();if(done)break;constchunk=decoder.decode(value,{stream: true});console.log(chunk);}console.log("Stream complete");}fetchAndStream('https://your-sse-endpoint.com/stream');
Hello,
I've been experimenting with various SSE libraries for my Angular app and found eventsource to be the most stable. However, I've encountered an issue where the stream sometimes gets cut off after re-initializing it.
Here's the scenario: when the dropdown value changes, a new stream is initialized with new parameters. Unfortunately, frequently changing the dropdown values often causes the stream to get stuck after fetching a few bytes of data. After about 45 seconds it returns error ERR_HTTP2_PROTOCOL_ERROR 200 (OK), the stream reinitializes and then works fine.
I initially suspected that Nginx might be the cause since it works perfectly fine locally. However, when I tried another library, event-source-polyfill, I couldn't reproduce the issue.
Has anyone else experienced something similar? I'll paste my code here for reference.
Version used: "eventsource": "^3.0.2"
Any help is appreciated!
The text was updated successfully, but these errors were encountered: