Services workers will live in the browser, so including them within your frontend bundle is the most suitable place for them.
- Keeping that in mind, let's create a file called firebase-messaging-sw.js and manifest.json file. The JavaScript file will be our service worker file and will host all major workload, and the JSON file will simply be a metadata config file.
- After that, ensure that you also create app.js file, where this file will be the starting point for our Authorization and custom UX. We will look into the importance of each file individually later on, but for now, go back to the firebase-messaging-sw.js file and write the following:
//[*] Importing Firebase Needed Dependencies importScripts('https://www.gstatic.com/firebasejs/ ...