Skip to content
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

Add log about browser tab sleeping #34008

Merged
merged 4 commits into from
Jul 28, 2021
Merged

Add log about browser tab sleeping #34008

merged 4 commits into from
Jul 28, 2021

Conversation

BrennanConroy
Copy link
Member

@BrennanConroy BrennanConroy commented Jul 1, 2021

In reaction to #33970

Added the freeze event handler log. (Thanks Sourabh)

@BrennanConroy BrennanConroy added area-signalr Includes: SignalR clients and servers feature-client-javascript Related to the SignalR JS client labels Jul 1, 2021
@pranavkm
Copy link
Contributor

@BrennanConroy does this also affect Blazor? (FYI @SteveSandersonMS)

@BrennanConroy
Copy link
Member Author

I assume you're still using the SignalR typescript client, so yes :)

@lewing
Copy link
Member

lewing commented Jul 16, 2021

cc @kg @pavelsavara

@kg
Copy link
Member

kg commented Jul 16, 2021

I think we should definitely integrate this, but it's unfortunate that Firefox doesn't support it. On the other hand, FF is less aggressive about pausing than Chrome right now.
Do we know what kind of caveats there are for this? Is Chrome likely to punish us for using it the way we intend to?

@BrennanConroy
Copy link
Member Author

Do we know what kind of caveats there are for this?

Other than the obvious ones like potential deadlocking if you use multiple locks and that the feature is experimental, I don't know of any caveats.

Is Chrome likely to punish us for using it the way we intend to?

No idea, I briefly talked to the Edge team and they didn't say not to use it, and that the heuristics they use probably wont remove WebLocks.

@davidfowl
Copy link
Member

I don't think this is a good idea. I can't articulate why as yet, but my Spidey sense tells me that this is a bad idea.

@kg
Copy link
Member

kg commented Jul 19, 2021

Note that from what I can tell from reading the relevant docs, this will only prevent the tab from being put to sleep (i.e. fully unloaded), and won't necessarily stop timers from being throttled down to a lower frequency. It's still worthwhile to avoid having the tab go to sleep either way. One thing is that there are some applications that probably won't want to have a WebLock active while they're waiting for things to happen, while other apps do want it. We may need to find a way to have the application author signal this.

@BrennanConroy
Copy link
Member Author

BrennanConroy commented Jul 19, 2021

Another option is we don't make any code changes and document how users can workaround the sleeping tabs issue in their own code.

Although, I would then keep the freeze event listener and potentially add a note about the docs.

@bradygaster
Copy link
Member

i like @BrennanConroy's suggestion. If @davidfowl (and @shirhatti) are iffy on this approach, let's wait and doc it.

@davidfowl
Copy link
Member

I much prefer the documentation suggestion rather than baking this into our library. We'll learn about the warts in a way that's possible for customers to work around.

@kg
Copy link
Member

kg commented Jul 19, 2021

Users are significantly inconvenienced by the current state of things, and it's possible for us to mitigate it through some library changes, but I agree that it's not necessarily right to bake in web locks.

@BrennanConroy
Copy link
Member Author

Updated to just be a log

@BrennanConroy BrennanConroy marked this pull request as ready for review July 20, 2021 20:00
@BrennanConroy BrennanConroy changed the title Use a WebLock to prevent browser tab from sleeping Add log about browser tab sleeping Jul 20, 2021
@BrennanConroy
Copy link
Member Author

BrennanConroy commented Jul 28, 2021

Ping, look at dotnet/AspNetCore.Docs#22773 too

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to understand the old comments and then I realized this used to be the WebLock PR 😄.

@samuelwine
Copy link

@BrennanConroy Please forgive me if this is the wrong place to ask...
I have a WebView within a Maui app, which displays my website which uses the javascript SignalR client library. I've been trying to use a weblock (as suggested in the docs) to keep the tab unfrozen, but this hasn't helped. Would it make sense that a WebView could be different in this respect than a regular browser tab?
Thank you

@ghost
Copy link

ghost commented Dec 9, 2022

Hi @samuelwine. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers feature-client-javascript Related to the SignalR JS client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants