This topic describes what service workers are and how to use them in platformOS.
Service workers are like a new set of features on the web that allow you to turn an application into a Progressive Web App (also known as a PWA), send push notifications, and improve performance by caching.
For security reasons, service workers can intercept requests only from the scope they are in.
For example, assuming you have
example.com/assets/js/sw.js, your SW can control requests sent to paths starting with
example.com/assets/js/ at most. That's why, most of the time, you want your SW file to be on the root domain, so you can control every request coming towards your application.
You can do that in platformOS by placing your SW files directly in the
assets/ directory and using this pattern to name them: