I have notifications enabled for a number of websites in Vanadium, for example, the Twitter PWA. They work great. I receive push notifications in my OS.

I understand that native apps can use FCM with Google Play Services for push notifications.

But how do push notifications from sites in Vanadium work, PWA or otherwise?

    • [deleted]

    That would also interest me. I prefer in some cases to use a web version of services instead of their apps but have no idea how to enable per site notification, mainly if they don't prompt you to use it. My web searches on this topic haven't produced any tangible results. Anyone could advise please?

      treequell [deleted]

      I was also curious about this, so I just did some quick research. Unless I'm misunderstanding something, this is how it works, roughly:

      • a PWA has a service worker
      • the PWA service worker subscribes to push notifications using PushManager.subscribe() https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe Seems subscribe() always returns with a PushSubscription object even if rejected (?).
      • the browser (somehow, not sure how) registers subscriptions through the OS(?). I'm guessing the browser uses APIs in whichever OS it's on to register the notifications. Or Google Play Services on Android, idk.
      • when all of this is done, the OS/Play/whatever (I'm assuming) returns info to the browser, which then returns a PushSubscription object to the PWA about the push subscription.
      • with info from the PushSubscription object, the web service has all the information it needs to push notifications to the correct push service endpoint.

      More info here:

      https://developer.mozilla.org/en-US/docs/Web/API/Push_API
      https://web.dev/push-notifications-overview/#send
      For apps using FCM, but should have some relevant info: https://firebase.google.com/docs/cloud-messaging/android/client

        unwat Thanks, I was reading some of those links just now.

        My question is, does Vanadium use Firebase Cloud Messaging as the push service? If so, it follows that Google Play Services are required for push notifications from Vanadium. From searching online, Chrome uses Firebase Cloud Messaging as the push service.

        To be clear what I mean about the push service, from: https://web.dev/push-notifications-overview/#send

        The push service receives [the web developer's] request, authenticates it, and routes the push message to the appropriate client...each browser uses whatever push service it wants.

        I guess to answer that question, I need to go and install some PWAs using Vanadium in a user profile without Google Mobile Services, and see if push notifications work.

          treequell

          I'm guessing it only works with Google Play Services, but curious to find out!

            [deleted]

            From reading: https://web.dev/push-notifications-overview/#send

            A website server has to make a web push protocol request to the push service implemented in the browser. I guess the pop-up to enable notifications is exactly this: the website making a web push protocol request. If a website doesn't make the web push protocol request, there's no way your browser push can deliver you notifications for that website. Because there are no notifications to deliver. Its something that the website has to implement.

            unwat

            I installed the PWA for hydrogen.element.io (a web app for Matrix) with Vanadium in two different user profiles. One with Google Play Services installed and the other without. I enabled notifications in both PWAs.

            In the user profile with Google Play Services, I receive push notifications when somebody pings me on Matrix. In the user profile without Google Play Services, I don't.

            This leads me to believe that Vanadium uses FCM as its push service. Which is what I thought was the case anyway. I'll try a few more PWAs to see if I can recreate.

            If that's confirmed, then it's only possible to get push notifications from PWAs in Vanadium if Google Play Services are installed in that same user profile.

              treequell It's most probably inherited from the fact that Vanadium is a Chromium fork, which unlike base AOSP code, has dependency on Play services on its features

              2 months later

              Sorry for the necro, but I was just pondering this myself.

              Chromium and by extension Vanadium indeed use FCM for push notifications. If you're getting push notifications at all you're connected to FCM. In fact chromium browsers keep a persistent connection to FCM in order to receive notifications from sites that are in the background -- not actually open in your browser. I want to do some digging with wireshark to see who I'm actually keeping persistent connections to.

              I had the realization that probably over 75% of everyone with a computer, or phone is connected to google's servers, uploading their (imprecise) location via their IP address 100% of every day.

              It's interesting that you don't get pushes when google play services are off though, I kind of assumed chrome has it's own backend / service for push. (I think web push is a different protocol)

              a year later

              I can confirm, Judging by my own experience push notifications won't work for Vanadium unless google services is installed.