Push
High level push architecture
The following sequence diagram describes the high level push architecture as observed by web application. The diagram describes the interactions between a Web application’s client code running in the browser, Firefox, Autopush (Firefox’s push server that delivers push notifications) and a third party server that sends the push notifications to Autopush
The dotted lines are done by the consumer of push.
Firefox Desktop
Flow diagram for source code
The source code for push is available under dom/push
in mozilla-central.
The following flow diagram describes how different modules interact with each other to provide the push API to consumers.
The Push Web Socket
Push in Firefox Desktop communicates with Autopush using a web socket connection.
The web socket connection is created as the browser initializes and is managed by the following state diagram.
Once the Push web socket is on the Ready
state, it is ready to send new subscriptions to Autopush, and receive push notifications from those subscriptions.
Push uses an observer pattern to notify observers of any incoming push notifications. See the high level architecture section.
Push Storage
Push uses IndexedDB to store subscriptions for the following reasons:
In case the consumer attempts to re-subscribe, storage is used as a cache to serve the URL and the public key
In order to persist the private key, so that it can be used to decrypt any incoming push notifications
The following is what gets persisted:
Firefox for Android
See also:
Flow diagram for source code
The source code for push is available under the following paths in mozilla-central:
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebPush*.java
Under
mobile/android/android-components/components
:
The following flow diagram describes how different modules interact with each other to provide the push API to consumers.