Introduction to Service Workers

Introduction to service workers

Service Workers are the core components of Progressive Web Apps (PWA), because they allow caching of resources, which will help in offline experience and push notifications, which help for re marketing and engagement, two of the main distinguishing features that up to now set native apps apart.
Introduction to Service workers

A Service Worker is essentially programmable proxy between web page and the network, it gives ability to intercept and cache network requests, effectively giving the ability to create an offline experience for web app, which is one of the biggest advantages of native app over web app.

It’s a special kind of web worker, a JavaScript file associated with a web page which runs on a worker context, separate from the main thread, giving the benefit of being non-blocking — so computations can be done without sacrificing the UI responsiveness. Being on a separate thread it has no DOM access, and no access to the Local Storage APIs and the XHR API as well, and it can only communicate back to the main thread using the Channel Messaging API.
Service workers also work with some other interfaces like:
  • Promises
  • Cache API
  • Fetch API

Advantages

  • Offline Support
  • Precache assets during installation.
  • Caching network requests using Fetch API
  • Engagement and Re Marketing using Push Notifications via Notification API
  • Works on background thread so that UI doesn’t get effected or wont have lag.
  • It can work even when app isn’t running on the browser.
You can essentially make a web app give a feel of native app with the help of Service workers and best part is it does not have to be installed on customers mobile and does not have to code in native language.

Here is the small Introduction about Service workers.

Feel free to comment to this post or you can drop an email at naik899@gmail.com.
Thanks for dropping by !! Keep watching this space for latest updates in tech and frameworks.

The post Introduction to Service workers was first published on Ravindra Naik

Comments

Popular posts from this blog

Introduction to Git

Create a calendar invite (ics file) in ASP NET

Create a Central Logging System