I'm setting up firebase messaging service on my existed server, but found some issues.
For instance, my site has the domain https://foo.bar/ and I put my new PWA for firebase messaging under https://foo.bar/firemessage/. then I implemented:
firebaseMessage.onMessage(function(){...})
in https://foo.bar/firemessage/index.html
firebaseMessage.setBackgroundMessageHandler(function(){...})
in service_worker.js
what foreground onMessage() do is passing the message payload to service_worker.js then service_worker.js pops Notifications out.
After few tests I found that the messaging won't work while a page other than /foo.bar/firemessage/index.html is leaved opened in browser, otherwise it works fine. for more instances if browser(Chrome) has these opened:
https://foo.bar/red/rose.html => blocks fcm
https://foo.bar/index.html => blocks fcm
https://foo.bar/firemessage/index.html => fcm works
https://foo.bar/firemessage => fcm works
https://google.com/ => fcm works
I won't able to implement firebase messaging in every page on the server, time cost will be unacceptably high. Does anyone got ideas dealing with this problem?
Aucun commentaire:
Enregistrer un commentaire