Bug 182565

Summary: Feature: Add support for the ServiceWorkerRegistration's SyncManager interface
Product: WebKit Reporter: Thomas Steiner <tomac>
Component: Service WorkersAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Enhancement CC: cdumez, cedric, cormac.bonner, eneskaya, mail, marcel, martiminchev, mjs, nicolas, rbyers, splaktar, stefan, talk, tnoliveira, wangxgwxg, webkit-bug-importer, webkit, youennf
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: Unspecified   
OS: Unspecified   

Description Thomas Steiner 2018-02-07 00:45:43 PST
This Feature Request is to gauge WebKit's interest in implementing the ServiceWorkerRegistration's SyncManager interface (https://wicg.github.io/BackgroundSync/spec/#sync-manager-interface), aka. "Background Sync".

It's "live" in Chrome (https://www.chromestatus.com/feature/6170807885627392) and "in development" in Firefox (https://groups.google.com/forum/#!msg/mozilla.dev.platform/cTAnBeZFtUE/kx0I4UC-AQAJ).
Comment 1 Rick Byers 2018-02-09 07:43:31 PST
Thomas, can you add any examples of real sites you know of leveraging this in the wild today?  I.e. how will the user (or developer) experience be better on real sites if this is shipped?  I believe that's the sort of information Apple needs in order to figure out how to prioritize requests like this.
Comment 2 Thomas Steiner 2018-02-16 00:09:47 PST
(Sorry this took longer, I was traveling.)

I synced back (no pun intended) with a number of colleagues, and we crowdsourced three main themes where this technology is used in practice:

1) Updating in the Background:
Applications can use this technology to update information required by the app in the background. This currency converter PWA https://material.money/ is a great example. Another example is https://r.nikkei.com/ that uses Background Sync to update their offline caches.

2) Offline Analytics:
Background Sync can be used to replay failed requests, for example, to a Web analytics endpoint. See https://developers.google.com/web/tools/workbox/modules/workbox-google-analytics for a real-world integration with Google Analytics. Offline analytics is one of the highly demanded PWA features by both advertisers and publishers.

3) "Fire and forget":
Chat applications can use this to allow users to send messages that reliably eventually will be sent, no matter the current network connection. This demo https://jakearchibald-gcm.appspot.com/ shows this in action. Likewise, the technology can be used for queuing comments on blog posts etc., here is a demo: https://justmarkup.github.io/demos/form-enhancement/v7/.

Hope this helps Apple prioritize the feature request. Happy to add more detail upon request.
Comment 3 Thomas Steiner 2018-02-28 21:00:06 PST
Adding a comment from Pinterest’s Engineering Manager Zack Argyle demonstrating the potential real world impact of implementing this feature request:

“We enabled service worker BackgroundSync for logging requests in Pinterest's mobile #pwa and are recovering ~370k requests/day. Each of those requests contains multiple logs. That's amazing! Going to ship that experiment today for sure.”—http://twitter.com/ZackArgyle/status/969049287408701441
Comment 4 Radar WebKit Bug Importer 2018-08-28 10:03:27 PDT
<rdar://problem/43802007>
Comment 5 Philipp 2019-04-09 14:02:07 PDT
+1 Would be great to have this
Comment 6 Ernst 2019-04-15 01:42:09 PDT
+1 It will be fantastic to have this.
Comment 7 Thomas Steiner 2019-06-20 15:36:07 PDT
The Google Search team have just documented why they need the Background Sync API: https://web.dev/google-search-sw/#meaningful-offline-experience.
Comment 8 Maciej Stachowiak 2019-06-20 17:42:19 PDT
Does Google Search use case require Background Sync to work even in a non-PWA/installed context? It was hard to tell from the post. Exposing it without an install action would be worrisome.
Comment 9 Thomas Steiner 2019-06-21 02:16:37 PDT
(In reply to Maciej Stachowiak from comment #8)
> Does Google Search use case require Background Sync to work even in a
> non-PWA/installed context? It was hard to tell from the post. Exposing it
> without an install action would be worrisome.

This is purely for the website, yes. Quoting from https://web.dev/google-search-sw/#non-goals: "Rather than trying to turn the Google Search web experience into the equivalent of what you'd expect from an installed application, the focus on the initial roll out was to progressively enhance the existing web site."
Comment 10 Cormac Bonner 2019-09-10 04:58:36 PDT
This feature, along with push notifications, is a key feature for us. Our users our regularly in low connectivity environments and therefore need to be able to work offline and sync up when back online.
Comment 11 Tomás Oliveira 2019-09-12 15:11:21 PDT
+1 This feature is important for a web application we are currently developing.