A presentation at NDC Porto 2022 in in Porto, Portugal by Jeremy Wagner
The Service Worker API is the Dremel of the web platform. It offers the ability to intercept requests and respond to them, while also improving reliability and performance through offline access and caching. Even so, service workers can do more than what we’ve commonly used them for. That goes double for improving the performance of multipage websites when we add streaming to the mix.
Streaming isn’t a new concept. You request a resource, but rather than wait for the resource to arrive in its entirety before processing it, you process it in chunks as it arrives over the wire. On the web, this leads to faster rendering. When applied to service workers, this involves placing the markup for common user interface elements of a page in the service worker cache, then combining and streaming that cached markup of the page with markup from the network.
The results are more compelling than you might think, and the end result is a faster and more resilient experience for more people in more situations, and can substantially improve performance even in places where network connectivity is scant. In this session, you’ll find out how to apply this technique, and see how it can improve the user experience.