-
Notifications
You must be signed in to change notification settings - Fork 56
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
Periodic Background Sync #367
Comments
Discussed in Reykjavik. I see there is an initial privacy writeup (happy it's started) + permission. Permissions by default? |
The explainer talks about the browser being able to respect 'do not disturb' - would it also be able/intended to respect metered connections/roaming and power save mode? Would be good to add to the explainer then |
Thanks! We've exposed a periodic-background-sync permission through the Permissions API. Using that permission may show a permission request to the user, depending on the browser implementation. The feature must only be available on secure origins, and may be further restricted to installed web apps only, based on the browser implementation. Notifications are suppressed by the OS in DND mode, and so we don't feel that the Periodic Background Sync spec needs to define any special treatment of DND. Please let us know if you disagree. Regarding changing behavior on metered connections and in power save mode, we're of the opinion that this should be by way of guidance, rather than a requirement. I'm happy to include words to that effect in the explainer. I'll update it soon. :) Thanks for the feedback! |
@mugdhalakhani |
It'll work for PWAs on Desktop as well. |
Thanks for this, @mugdhalakhani! We're looking at this in our face-to-face TAG meeting in Tokyo. We're curious about your thoughts on @kenchris's question. If the user can't specify behaviour on things like battery life and metered connections, is that going to confuse the user? We are thinking specifically about the example of tethering on your phone, where your browser assumes it's on a fat pipe while in fact you want the connection to use as little data as possible. We'd welcome your thoughts. And we're happy to see that you've exposed the permissions through the Permissions API. It also raises the question though about what happens in browsers that haven't implemented the Permissions API? Also, how should a user revoke the permission? (Revoking is linked to the previous paragraph too.) |
Thanks for the question Hadley. We have to distinguish between controls the developer has for this API, and those the user does. Our reasoning is that the developer can't reliably differentiate a metered connection from an unmetered one, any better than the browser can. The browser doesn't need to rely on the developer correctly setting these levers when it can detect these situations itself. You are right that there may be cases when the browser might not detect the type of connection correctly, like the tethering example you gave. Regarding your other question, note that Permissions API is simply a way for the developer to query the status of this permission through Javascript. A user prompt may or may not be shown to the user, depending on the browser implementation. Chrome's current implementation automatically denies 'periodic-background-sync' for any request made from outside a PWA and no user prompt is shown. My point is that even if the browser has an implementation of the Permissions API, the user might not be prompted for a permission. However, the spec can mandate that the user or the user agent on behalf of the user grant permission before this API can be used. (I'm looking at https://notifications.spec.whatwg.org/#permission-model for inspiration). I've proposed adding words to this effect in the PR as well: How to revoke the permission is again browser implementation dependent and will be done through the browser's UI. The Permission API spec mandates that the browser implementation must notify the appropriate components when the user revokes permission for a capability for a site. |
@hadleybeeman, the Chrome origin trial for the API is coming to an end, and I was wondering if my answers to your previous questions make sense, and if you had any other comments about the API. |
Hi there, We read about the discussions at TPAC: https://jakearchibald.com/2019/service-workers-tpac/ and were wondering about the steps going forward? It seems that background fetch can cover many of the same use-cases and we wonder whether you are still pursuing background sync. In a way we feel that background sync is changing the core behavior of the web. One of the sales pitches that I have heard for PWAs is that, unlike native apps, if you don't use them, then they don't update and don't waste your data plans. Basically, you can install a PWA and not use it for a year and only when you open it up (or load the web site) it is able to update itself via the SW and regular caching. It feels like background sync changes all of that, and thus a core tenet of the web, at least as long as there are no strong restrictions on how often and how long after last use background sync can be active. This also touches a bit on silent push notifications (which are currently not allowed - they need to show UI), these could potentially be used to sync in a similar fashion. We understand that background sync can be limited by the platform (they are just a hint) but what makes them radically different? |
The discussion at TPAC focussed on one-off Background Sync Let's focus on Periodic Background Sync here.
Let me know if this answers your questions. @beverloo, @jaffathecake, feel free to add to this. |
Thanks for the answers, this sounds good. I didn't know that there was a one-off background sync as well, but I found it here: https://github.com/WICG/BackgroundSync/blob/master/explainers/sync-explainer.md Are you thinking about adding some UI notification showing that the site is sync'ing in case users would want to block that? or do you expect the sync to be so fast that that doesn't make sense? Is there a restriction on how long you can spend in a sync event? I know that SWs are killed if they spend too much time. |
I think it would be a good idea to turn off sync when the Save-Data header is present https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/save-data/ |
@kenchris and I were reviewing this specification during our Wellington F2F. |
@mugdhalakhani, @KenjiBaheux any update? |
According to https://goo.gle/fugu-api-tracker this is already shipping in Chrome since M80 |
@kenchris Just FYI: my PR to update MDN with Periodic Background Sync availability was approved at the beginning of May: mdn/browser-compat-data#6030 |
It is shipping in M80 according to https://chromestatus.com/features/5689383275462656 |
This is exactly what I submitted :) |
Yes this API has already been shipped in Chrome, sorry for the delayed response and thanks for the suggestions!
Let me know if you think the browser should do things differently. |
Hi, thank you for your response. |
Ping, did anyone consider @ylafon 's last comment? |
ylafon@'s suggestion of triggering an unregister on 4xx or 5xx errors makes sense to me. I've filed WICG/periodic-background-sync#3 to track the update to the spec. |
Thanks for filing the issue @mugdhalakhani - I don't think there is much more for us to do here, so I propose closing. Thanks for bringing this to the TAG |
Thanks for all the feedback here! |
Góðan dag TAG!
I'm requesting a TAG review of:
https://docs.google.com/document/d/1FI4x3G6vzEWDplghSx-pH13aAwuGHiUGtXliEkZf0Vc/edit
https://github.com/mugdhalakhani/mugdhalakhani.github.io/tree/master/periodic_sync
(Demo at: https://webplatformapis.com)
Some WPT tests here:
https://wpt.fyi/results/PeriodicBackgroundSync?label=master&label=experimental&aligned&q=periodicbackgroundsync
You should also know that...
The spec is in review, so this is more of an opportunity to review the proposed API.
We'd prefer the TAG provide feedback as (please select one):
The text was updated successfully, but these errors were encountered: