uqutub / pwa-FCM

Progressive Web App Push Notification using FCM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

				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))

About

Progressive Web App Push Notification using FCM


Languages

Language:JavaScript 65.7%Language:HTML 34.3%