-
Notifications
You must be signed in to change notification settings - Fork 83
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
Use Push and a Background Fetch/XHR instead of background sync #18
Comments
|
Actually, on both Android and iOS, native apps use a mix of polling and push for syncing. Apple's gives nuanced advice[1] to developers on when to use their two APIs (introduced simultaneously in iOS 7):
[1]: from WWDC 2013 "What's New with Multitasking" Android tends to lean slightly more towards Push, because GCM has more advanced features like delay_while_idle meaning it can be more efficient if you send a lot of low-priority push messages; but it's still more appropriate to use polling on Android (preferably as a Sync Adapter that can be batched together with other syncs) for frequently updating streams of information. For example, I would expect a well-written Twitter client to use background syncs to periodically update the feeds you subscribe to, but use push messaging to receive private messages (and perhaps @ mentions) you get sent, so that it can show you immediate notifications for the latter.
That could be a very reasonable alternative to non-repeating syncs. Need to think about that more.
Except:
|
Thanks John, that convinces me that sync is needed. Large background down/uploads will be for another api. |
Given our use cases: periodic refresh, background upload/download of messages and bulk data, we might be better served by breaking the cases apart into the following:
Periodic refresh (twitter, mail, news articles): Use the push API like native apps already do today.
Retry upload of message when next online: SW.fetch (or perhaps XHR) with background capability that fires a SW event (or writes to indexedDB?) when done.
Background fetch would support resumable downloads immediately and resumable uploads would come in the future as we made progress on that.
The text was updated successfully, but these errors were encountered: