Search code examples
web-push

Web Push - Do they use public servers like google etc?


As I understand Web Push, the messages are transferred over a public server like googleapi, mozilla or whatever. Is this correct?

So I can't use this functionality in a private network with a private server without access to the public network? (How can this function be used in a private environment?)


Solution

  • Yes, Web Push uses a public server to deliver push notifications. This is done to use just one connection to receive push notifications from multiple websites.

    From Firefox documentation:

    What information does Firefox use to provide Web Push?

    Firefox maintains an active connection to a push service in order to receive push messages as long as it is open. The connection ends when Firefox is closed. On our server we store a randomized identifier for your browser, along with a randomized identifier for each site you authorize.

    On Firefox for desktop, the push service is operated by Mozilla. Firefox for Android uses a combination of the Mozilla Web Push service and Google’s Cloud Messaging platform to deliver notifications to Firefox for Android.

    In both cases, push messages are encrypted per the IETF spec and only your copy of Firefox can decipher them. The encrypted messages are stored on the server until they are delivered or expire.

    Similarly, Chrome receives push notification via Google servers. If these servers are inaccessible, Web Push won't work.

    One possible way to use Web Push in an isolated network is to set up your own push server. The code of Mozilla push server is available online, so with some luck you may be able to make it work in your network. Then you'll have to configure all Firefox instances to use your server (the preference is named dom.push.serverURL). I don't know if anything similar is possible with Chrome.

    You may also use Notifications API to show notifications without using Web Push. This only works while the user has your website open, however.