fetch-event-source icon indicating copy to clipboard operation
fetch-event-source copied to clipboard

Request: Improve documentation for `openWhenHidden` property

Open jchiare opened this issue 2 years ago • 15 comments

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!

jchiare avatar Mar 26 '23 16:03 jchiare

Thanks for this, I was wondering where that behaviour was coming from! I agree that documenting this functionality would be very useful.

martinseanhunt avatar Apr 28 '23 07:04 martinseanhunt

Up

codeXLinkX avatar May 05 '23 10:05 codeXLinkX

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.

devenbhooshan avatar May 29 '23 12:05 devenbhooshan

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....

tpfau avatar Jun 16 '23 08:06 tpfau

Good advice. This parameter can only be found by looking at the source code

crown-li avatar Jul 04 '23 09:07 crown-li

I agree

ashi-dog avatar Jul 07 '23 07:07 ashi-dog

yes, I think it's better to set openWhenHidden be true in default.

backas36 avatar Jul 07 '23 07:07 backas36

Agree , I spent two weeks looking for this problem

easychen avatar Aug 05 '23 08:08 easychen

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

chidera-ugo avatar Nov 01 '23 08:11 chidera-ugo

agree!

acodercat avatar Feb 29 '24 21:02 acodercat

is there a way to keep fetching in the background when switching tabs? openWhenHidden: true keeps the connection alive but its not contitue fetching?

att1106 avatar Mar 09 '24 10:03 att1106

i agree!

wahsggx avatar Mar 19 '24 07:03 wahsggx

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 🤦‍♂️

100gle avatar Mar 27 '24 08:03 100gle

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.

IAkumaI avatar Apr 11 '24 12:04 IAkumaI