Wednesday, December 12, 2018

The Power Behind Progressive Web Apps: Service Workers

One of the most common questions I get regarding Progressive Web Apps is, “how does it differ from a responsive website?”. I get where the question is coming from, because yes, PWAs are hosted behind a URL, so technically they are web experiences. But the magic of a PWA lies in its technical underbelly–the scripts and elements that allow a responsive site to transition into a truly app-like experience. One of the most prominent–and important–technical elements required for this transition is a service worker.

What It Does
When you think of your experience with a native mobile app, what do you think of? Most likely, you think of things like push notifications or native functionality like geo-location and camera integrations. A service worker makes it possible to integrate these types of native functionalities into your mobile experience, making it totally app-like. A few of the functionalities made possible by a service worker are push notifications, offline caching, and background syncs. And, Google has teased that even more native functionality (like geofencing) will be supported by service workers in the near future. If we really think about why we download apps in the first place, it’s likely for the native functionality it provides, like push notifications or location-based services. With a service worker, you can provide this app-like experience to your users, but without the hassle of an app store download.  

How It Works
If you’re looking for a full technical deep-dive into implementation and testing, I’m going to send you to the experts at Google. But if you’re looking for a quick marketing-approved overview, I’ve got you covered. Essentially, when you implement a service worker behind your webpage, it runs in the background and allows you to integrate with those native phone features. Think of it as a bridge between the web app, the browser, and the network. While it’s running, it caches information and resources so the user can access it later when they’re offline.

So, there’s the answer to the question on everyone’s minds! Service workers, in conjunction with a few other key technical elements, are the real differentiator between a responsive website and a truly app-like PWA. They’re working to ensure the most native-like experience possible via the mobile web. If you want a bit more service worker info, check out this video from our Whiteboard Wednesday series.