I'm just curious to understand if anyone is using service workers for their web app in production and if so, what use cases does it solve particularly well.
More specifically, in terms of caching, apart from working offline how is it different from browser/CDN cache? What if your service worker itself is cached for sometime and you want to rollout an update? What are the best practices? How has your experience been maintaining service worker on a production app? What about security?
I know notifications can be done, server push with HTTP/2 etc. But which kind of web apps can make the best use of service workers and which ones shouldn't implement it?
Atul Sharma
Full Stack Developer | Cloud Native Applications
Using Service worker is a good way to make your website offline but there are many problems.
Using service-workers for normal sites for caching when you have no intention of making site offline ... DON't USE. Browser caching with headers work way more simpler & in a controlled manner than service-workers.
Identifying the right caching policy for service-workers is always a headache. Most of the time it will keep old cache (everything) no matter your content on server is updated or not. ( As it doesn't check for caching headers or E-Tag policies).
There are lot of more issues you will encounter when you start using it.
So, if you have plans to make your website offline go for it.. Otherwise don't go if you are planning to use it for normal caching n stuff and don't have enough time for proper research.