Dear Anvil team,
I was looking into a way of integrating push notifications and came across the work of Chad . I tried setting it up and to use Firebase to send push notifications but it seems that the push notifications have some inconsistent behaviour.
To integrate them with Firebase, one needs to employ a service worker to handle the messages. However, when we upload it to the assets directory, it is not served from the root, but from a different location. According to the service worker documentation, it only affects pages that are within the same folder as the service worker. The scope can be increased, but for that a line in the http-header response of the server would have to be added.
Or do you think using routing would help somehow?
We would like to ask you to have a look into this and tell us your opinion. I would like try if it is possible to install an anvil app as pwa and then deploy some badges or notifications. I am working on a small board game for two players and would like to use push notifications to notify the opponent that it is their turn
Thank you
possible response header to extend the scope of service workers
Service-Worker-Allowed: /
The current response headers look like this, at least from what I could get via
HTTP/1.1 302 Found
content-length: 0
location: https://the-app-location.anvil.app/
cache-control: no-cache