Service Worker Development Cookbook

Build highly available and performant native web applications that seamlessly integrate with third-party APIs
Preview in Mapt

Service Worker Development Cookbook

Sean Amarasinghe

1 customer reviews
Build highly available and performant native web applications that seamlessly integrate with third-party APIs
Mapt Subscription
FREE
$29.99/m after trial
eBook
$20.00
RRP $39.99
Save 49%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$20.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Service Worker Development Cookbook Book Cover
Service Worker Development Cookbook
$ 39.99
$ 20.00
Vue.js 2 Cookbook Book Cover
Vue.js 2 Cookbook
$ 35.99
$ 18.00
Buy 2 for $35.00
Save $40.98
Add to Cart

Book Details

ISBN 139781786465290
Paperback384 pages

Book Description

It would be nice to have web apps that work offline and send push notifications. This is now possible with Service Workers, which can add native-like functionality to your web apps without requiring a download.

This book will get your mobile and web apps functioning without Internet connectivity, improve performance and network interaction in order to increase the level of availability, and show you how to build performant applications that seamlessly integrate with third-party APIs.

We’ll show you how to add Service Worker functionality to web apps and sites, access offline content through basic and advanced techniques, and build powerful interactive system notifications. We’ll also teach you about cache functionality and assets to provide immediate load even over narrow connections. We conclude by giving you various tips to improve app performance, including the background sync technique.

By the end of this book, you’ll know build high performing and faster web and mobile applications with Service Workers.

Table of Contents

Chapter 1: Learning Service Worker Basics
Introduction
Setting up service workers
Setting up SSL for Windows
Setting up SSL for Mac
Setting up GitHub pages for SSL
Registering a service worker
Registering a service worker in detail
Debugging
Providing a stale version on error
Creating mock responses
Handling request timeouts
Chapter 2: Working with Resource Files
Introduction
Displaying a custom offline page
Loading images offline
Loading CSS offline
Loading fonts offline
Implementing multiple fetch handlers
Fetching remote resources
Chapter 3: Accessing Offline Content
Introduction
Caching critical resources for offline use
Showing cached content first
Implementing a cache and network race
Using window.caches
Implementing stale-while-revalidate
Chapter 4: Accessing Offline Content with Advanced Techniques
Introduction
Templating
Implementing read-through caching
Allowing offline Google Analytics
Allowing offline user interaction
Implementing selective caching
Chapter 5: Reaching Beyond the Offline Cache
Introduction
Getting network responses offline
Caching content from ZIP
Selecting the best content provider (load balancer)
Redirecting a request
Setting request headers
Making a service worker act like a remote server
Making a service worker act as a dependency injector
Forcing immediate control
Implementing fallback responses
Deferring offline requests
Chapter 6: Working with Advanced Libraries
Introduction
Working with global APIs
Implementing a circuit breaker
Implementing a dead letter queue
Logging API analytics
Working with Google Analytics
Chapter 7: Fetching Resources
Introduction
Fetching remote resources
Fetching with FetchEvent
Fetching a JSON file during service worker installation
Proxying
Prefetching
Chapter 8: Experimenting with Web Push
Introduction
Implementing a simple push notification
Showing rich notifications
Using the notification tag
Implementing push clients
Subscribing to push notifications
Managing push notification quotas
Chapter 9: Looking at General Usage
Introduction
Taking immediate control of the page
Working with slow responses
Relaying messages
Using a service worker as a proxy middleware
Using a service worker with a live flowchart
Chapter 10: Improving Performance
Introduction
Performing network requests from a cache
Performing network requests from a network
Testing waitUntil
Implementing background sync
Sending forward requests
Avoiding model fetching and render times

What You Will Learn

  • Display a custom offline page
  • Cache critical resources for offline use
  • Implement offline Google Analytics
  • Get network responses offline
  • Implement push notifications
  • Improve performance of your app

Authors

Table of Contents

Chapter 1: Learning Service Worker Basics
Introduction
Setting up service workers
Setting up SSL for Windows
Setting up SSL for Mac
Setting up GitHub pages for SSL
Registering a service worker
Registering a service worker in detail
Debugging
Providing a stale version on error
Creating mock responses
Handling request timeouts
Chapter 2: Working with Resource Files
Introduction
Displaying a custom offline page
Loading images offline
Loading CSS offline
Loading fonts offline
Implementing multiple fetch handlers
Fetching remote resources
Chapter 3: Accessing Offline Content
Introduction
Caching critical resources for offline use
Showing cached content first
Implementing a cache and network race
Using window.caches
Implementing stale-while-revalidate
Chapter 4: Accessing Offline Content with Advanced Techniques
Introduction
Templating
Implementing read-through caching
Allowing offline Google Analytics
Allowing offline user interaction
Implementing selective caching
Chapter 5: Reaching Beyond the Offline Cache
Introduction
Getting network responses offline
Caching content from ZIP
Selecting the best content provider (load balancer)
Redirecting a request
Setting request headers
Making a service worker act like a remote server
Making a service worker act as a dependency injector
Forcing immediate control
Implementing fallback responses
Deferring offline requests
Chapter 6: Working with Advanced Libraries
Introduction
Working with global APIs
Implementing a circuit breaker
Implementing a dead letter queue
Logging API analytics
Working with Google Analytics
Chapter 7: Fetching Resources
Introduction
Fetching remote resources
Fetching with FetchEvent
Fetching a JSON file during service worker installation
Proxying
Prefetching
Chapter 8: Experimenting with Web Push
Introduction
Implementing a simple push notification
Showing rich notifications
Using the notification tag
Implementing push clients
Subscribing to push notifications
Managing push notification quotas
Chapter 9: Looking at General Usage
Introduction
Taking immediate control of the page
Working with slow responses
Relaying messages
Using a service worker as a proxy middleware
Using a service worker with a live flowchart
Chapter 10: Improving Performance
Introduction
Performing network requests from a cache
Performing network requests from a network
Testing waitUntil
Implementing background sync
Sending forward requests
Avoiding model fetching and render times

Book Details

ISBN 139781786465290
Paperback384 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Vue.js 2 Cookbook Book Cover
Vue.js 2 Cookbook
$ 35.99
$ 18.00
Understanding Software Book Cover
Understanding Software
$ 23.99
$ 12.00
Progressive Web Apps with React Book Cover
Progressive Web Apps with React
$ 35.99
$ 18.00
Learning Vue.js 2 Book Cover
Learning Vue.js 2
$ 35.99
$ 18.00
Mastering JavaScript Functional Programming Book Cover
Mastering JavaScript Functional Programming
$ 35.99
$ 18.00
JavaScript : Moving to ES2015 Book Cover
JavaScript : Moving to ES2015
$ 63.99
$ 32.00