Need help getting this working

Recommend this page to a friend!

      PHP Web Push Notifications Server  >  All threads  >  Need help getting this working  >  (Un) Subscribe thread alerts  
Subject:Need help getting this working
Summary:Service worker pnSubscribe never being invoked
Messages:2
Author:Musaffar
Date:2021-06-18 11:49:00
 

  1. Need help getting this working   Reply   Report abuse  
Picture of Musaffar Musaffar - 2021-06-18 11:49:00
Hi

Thanks for the stand alone package.

I am attempting to put together a simple working example and making some progress.

I have configures the various params such as VAPID keys and Subscriber URL and can load PNTestClient.html which I am using to test this.

When I push the the "subscribe PUSH notifications" button, the browser seems to subscribe, however the function pnSubscribe in PNServiceWorker.js never gets called - therefore the subscription never gets saved server side.

Could you point me to anything obvious I may have missed?

Testing on Chrome 91.0.4472.114 Windows 10

Kind Regards
Musaffar

  2. Re: Need help getting this working   Reply   Report abuse  
Picture of Stefan Kientzler Stefan Kientzler - 2021-06-19 11:13:36 - In reply to message 1 from Musaffar
Hi Musaffar,

does the site run in secure context?

Do you have following output from the PNTestClient.html:

Secure context: true
Notification: defined
PushManager: defined
serviceWorker: not defined
Notification.permission: default

What message is shown in the browser console when you click the
[Subscribe PUSH Notifications] Button?

regards, Stefan

 

For more information send a message to info at phpclasses dot org.