Skip to content

Latest commit

 

History

History
27 lines (14 loc) · 2.82 KB

DEVELOPMENT_PATH_WEB.md

File metadata and controls

27 lines (14 loc) · 2.82 KB

Steps for implementing Web Push for supported browsers and PWA.

This is running in production with https://www.activitree.com

Activitree

meteor add activitree:push

** If you are looking for a more complex implementation of a Meteor PWA with Notifications, Offline Caching and Offline experience, please visit this repo: https://github.com/activitree/Meteor-PWA-Explained

As of 2.0.6, activitree:push looks for a Firebase configuration (client side) and if one is found, the package calls for an installation of /firebase-messaging-sw.js otherwise it will default to sw.js. You are expected to have both files in your /public folder if you plan to use Web Push notifications. Documentation here: https://github.com/activitree/Meteor-PWA-Explained/blob/master/3_Service_workers.md

Copy the worker file here: https://github.com/activitree/meteor-push/blob/master/example/app/public/firebase-messaging-sw.js to your public folder. This needs to be available at https://www.your_address.com/firebase-messaging-sw.js. This worker is responsible for handling backgroud messages. Your 'action' key in the notification object contains the URL that will be open when the notification on screen is being clicked on.

Note: With Firebase, some of the public credentials are exposed and visible on the client. Read this for an understanding of how to restrict public API keys in Firebase: https://medium.com/@impaachu/how-to-secure-your-firebase-project-even-when-your-api-key-is-publicly-available-a462a2a58843