Background Sync & Push Notifications
- Understand how background sync works with Service Workers to queue network requests
- Be able to implement push notifications when a sync event is complete
- is an API dependent on Service Workers
- allows us to defer an action to a later point in time when a user has a more stable network connection
- enables us to send notifications outside the context of a browser page
- mimics the notification functionality we're familiar with on our phones and devices
When Do I Use These?
- when a user is manipulating application data through network requests but has an unstable or intermittent connection
Fetch and checkout the 'before-sync-lesson' branch of the offline news repo
- Added a tiny form so that any bozo can add their own news
What Are Our Goals?
- Set up communication between our client-side code and our service worker
- Service worker intercepts POST request and waits for network connectivity before completing
- Upon completion, SW sends a message to the client to update the DOM
- Upon completion, SW sends a push notification to notify users it is complete