-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS/React SDKs: Pause SSE subscriptions when tab is hidden #1755
Conversation
Your preview environment pr-1755-bttf has been deployed with errors. |
This reverts commit add6d2f.
@@ -458,24 +500,21 @@ function disableChannel(channel: ScopedChannel) { | |||
channel.src.onerror = null; | |||
channel.src.close(); | |||
channel.src = null; | |||
if (channel.state === "active") { | |||
channel.state = "disabled"; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what happens if a channel is disabled while it's in an idle state? Wouldn't it then switch back to active when the page is focused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (probably) can't happen: we control when a channel gets disabled or idled, and we don't disable anything but active channels. I will add another safeguard just to be sure though...
The reverse can happen though: a disabled channel can be converted to idle, which should be fine given that 99% of the time it's disabled because of some connection error with exponential backoff, and waking up from idle state is a good enough alternative to backoff/retry.
Deploy preview for docs ready! ✅ Preview Built with commit 082425f. |
disableIdleStreams: true
. Can also configure theidleStreamInterval
(default 20 sec).Features and Changes
Dependencies
Testing
Screenshots