Mobile notifications

Perhaps a silly question, but do they even work? My phone keeps tabs active for some time even in background, and yet I haven’t ever received a notification in mobile version.

Tried Chrome, Opera and ‘Wolfery app’, notifications turned on both in in-game setting, site permissions and app permissions.

Not a silly question at all; it is not working for me either. Why? I am not sure.

I am looking at the issue, and also if we can use the so called Push API to get mobile notifications (at least for Android).

Anyone in the community who know more about how to get mobile notifications to work?

1 Like

Anyone in the community who know more about how to get mobile notifications to work?

As a matter of fact. The below might be chrome-specific, but I guess ff and safari are similar.

You use web-push - npm or similar to generate the PKI bits to talk to the chrome backend.

Then, from your service worker (which you already have), you subscribe to the pushes. It returns the endpoint which you send to the backend and the encryption keys. It might expire, if it does, the expiration will be passed along (this is browser specific).

Finally, from the backend, you use whatever the API, the initially generated cryptopair, and the per-user endpoint and keys to send the actual push.

You can also use setAppBadge from within the app to set the unread counter, but it’s not as useful.

1 Like