Push Notification Bridge
The Push Notification Bridge is a Diffusion™ client that subscribes to topics on behalf of other Diffusion clients and uses a push notification network to relay topic updates to the device where the client application is located.
- pn_bridge.jar
- This JAR file contains the Diffusion Java™ client that acts as a bridge between Diffusion and push notification networks.
- pn_bridge.bat and pn_bridge.sh
- These scripts can be used to start the Push Notification Bridge.
- PushNotifications.xml
- This XML file is used to configure the Push Notification Bridge.
- PushNotifications.xsd
- This XSD file defines the schema of the PushNotifications.xml file.
How the Push Notification Bridge works
A client sends a JavaScript Object Notation (JSON) message through a request topic to the Push Notification Bridge, requesting push notifications for a specific topic.
The topic that notifications are received for must be a single value topic.
- The client sends a request message to the service topic path that the bridge
listens on.
This topic path is defined in the PushNotifications.xml configuration file. For more information, see Configuring your Push Notification Bridge.
The request message is in JSON format. For more information about the request message format, see Request and response JSON formats.
- The Push Notification Bridge receives the message through the service topic path.
- The bridge attempts to subscribe to the topic.
- If the subscription is successful, the bridge stores the association between
the topic and the push notification destination. This can be represented by either an
Apple Push Notification service (APNs) device token or a Google Cloud Messaging (GCM) registration ID. The destination is the
combination of the client application and the device on which the client is
hosted. It is not the same as a client session.
The association between topic and destination is stored in memory, by default. You can persist this information by implementing your own persistence solution. For more information, see Push Notification Bridge persistence plugin.
- The bridge sends a response message to the client through its service topic
path.
The response message is in JSON format. For more information about the response message format, see Request and response JSON formats.
- The client receives the response message and can act on it.
When an update is received on a subscribed topic, the bridge sends a push notification to the destinations associated with that topic.
- The topic is updated.
- The Push Notification Bridge receives topic update and transforms the update
into JSON according to the template that is configured for the topic.
For more information about the JSON format of notifications, see Push notification JSON format. For more information about configuring templates, see PushNotifications.xml.
- The bridge looks up the destinations that have subscribed to receive push notifications for this topic.
- The bridge sends the push notifications to the push notification network.
The push notification network that the bridge uses depends on the transport prefix in the destination URI provided in the subscription request message.
- The push notification network sends the notification to the destination.