fetch-event-source
fetch-event-source copied to clipboard
Request: Improve documentation for `openWhenHidden` property
The default for openWhenHidden is false. This means that the SSE will abort on the client side if the document is hidden, however the default SSE behaviour is that the SSE will continue even if the document is hidden.
Since this is different then normal SSE, I think there should be something in the readme that says something along the lines of "To continue SSE streaming when browser is hidden, set openWhenHidden flag to true". I'm happy to do so if this is approved.
Thank you!
Thanks for this, I was wondering where that behaviour was coming from! I agree that documenting this functionality would be very useful.
Up
I wasted an hour figuring out why this wasn't working as expected. I expected openWhenHidden to be set true by default. Please add this in the documentation.
Please make this the default. This has driven me crazy for more than a day, and especially with web-apps requesting LLM streaming responses, this can cost money, when people tab out and into the tab and every time the request is resent....
Good advice. This parameter can only be found by looking at the source code
I agree
yes, I think it's better to set openWhenHidden be true in default.
Agree , I spent two weeks looking for this problem
on ios safari it seems this still doesn't work if the safari is in the background when the message is received, is there a fix for this
agree!
is there a way to keep fetching in the background when switching tabs? openWhenHidden: true keeps the connection alive but its not contitue fetching?
i agree!
I met this issue...I think this property should be set true by default or point out in documentation. Otherwise it is like a bug 🤦♂️
Oh my god, I thought I was going insane, looking for some chrome settings, digging into express configs and there is just a boolean setting for this.