PHP Classes

PNServiceWorker.js is not triggered

Recommend this page to a friend!

      PHP Web Push Notifications Server  >  PHP Web Push Notifications Server package blog  >  How to Use PHP to Sen...  >  All threads  >  PNServiceWorker.js is not triggered  >  (Un) Subscribe thread alerts  
Subject:PNServiceWorker.js is not triggered
Summary:PNServiceWorker.js is not triggered
Messages:2
Author:Abakus Baily
Date:2021-10-15 11:20:24
 

  1. PNServiceWorker.js is not triggered   Reply   Report abuse  
Picture of Abakus Baily Abakus Baily - 2021-10-15 11:20:24
Hello and thank you very much for sharing this package with us.
I'm trying to get your example script running but have the following problem:

The subscription at "PNTestClient.html" works fine. I got the following notes:

"PUSH Notifications are subscribed

Secure context: true
Notification: defined
PushManager: defined
serviceWorker: defined
Notification.permission: granted"

The console says: "Registration succeeded. Scope is https://mydomain.de/"


At "PNTestServer.php" it says following:

"Count of subscriptions: 0
no valid Subscriptions set!"


So the registration is not noticed by the server. So I started debugging and the following steps should get triggered in sequence:

1) Pushing the button "Subscribe PUSH Notifications"
2) call pnSubscribe()
3) Grant notifications in browser
4) call pnRegisterSW()
5) call "PNServiceWorker.js"
6) trigger event "activate"

But step no 6 isn't working because the event "activate" is not triggered. So I added the line "console.log("call PNServiceWorker.js");" at the beginning of the file "PNServiceWorker.js" to check if the file itself is running. But there is no console message so the "PNServiceWorker.js" isn't even running.

Do you have a clue, what could be wrong?

Thank you very much

  2. Re: PNServiceWorker.js is not triggered   Reply   Report abuse  
Picture of Dickie Lee Dickie Lee - 2021-11-08 13:54:23 - In reply to message 1 from Abakus Baily
Hi Abakus, how did you get your problem solved?
I've faced the same problem.

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