STEPS TO FOLLOW:
SERVER SIDE:
1) Create a cloud function and deploy it on firebase
CLIENT SIDE:
1)Ask for permission using requestPermission method
2)Initialize two listeners in service worker
i)push listener
ii)notificationClick (only if you want to implement click action)
3) Use this fetch request to send notification
fetch("yourFunctionUrlHere", {
method: 'POST',
body: {
token: "recieverTokenHere",
title: "messageTitleHere",
message:"messageHere",
url: "urlHere"(only if you want to implement click action)},
})
.then((res) =>console.log(res))
forked from uqutub/pwa-FCM
-
Notifications
You must be signed in to change notification settings - Fork 0
ManalLiaquat/pwa-FCM
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Progressive Web App Push Notification using FCM
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- JavaScript 65.7%
- HTML 34.3%