Push Notifications Overview
The Push Notifications feature make it possible for a production to send push notification messages to iOS and Google devices. This feature makes it possible to easily send notifications to a user with an app running on multiple devices. Your code can send notifications without having to be aware of the number of devices or whether the devices are iOS or Google devices.
Push notifications are typically used to:
Inform the user that an asynchronous request has finished and data is available.
Inform the user that a workflow reached a point which requires the user to take an action.
Raise awareness and ask the user to use the app or a feature of the app.
InterSystems IRIS supports the following push notification protocols:
iOS Push Notifications (APNS)
Google Cloud Messaging (GCM)
Apple significantly changed its Apple Push Notification service (APNs) on March 31, 2021. Contact your InterSystems representative for approaches to addressing current implementation restrictions.
The Push Notifications feature allows a production to initiate a notification that notifies the user on a mobile device. For example, an app can provide mobile device access to a system built on InterSystems IRIS. In most cases, the mobile app user is initiating actions, either querying to get information or adding or updating data. But in some cases, the production initiates the action to notify the mobile device user of some event or condition. The Push Notifications feature enables the InterSystems IRIS code to initiate the action and does not depend on the user actively using the app at the time the push notification is sent..
The push notifications protocols do not guarantee that a message will be delivered. Consequently, you should not use these protocols to send important data, but rather to notify the user that the data is available. The user is responsible for initiating an action based on the notification.
In order to enable push notifications, the mobile app registers with the APNS or GCM server and gets a token that identifies the app running on a specific device. The mobile app must also enable push notifications with the device operating system. The details for these operations are different for the APNS and GCM protocols. You can develop the app using any technology available on the device. Note that to use push notifications, the mobile app needs to either be a native app or be a hybrid web app and have a native component. A pure web app cannot use push notifications.
The Push Notification feature allows your production to push notifications to a user. If the user has multiple devices the notifications will be sent to all devices. Your code sending the notifications does not need to be aware of whether the user has multiple devices and whether the devices use the APNS or GCM protocols. Your code can send a single notifications to multiple devices for a user. The Push Notifications Identity Manager makes this possible.
The app running on the mobile device makes a call to your InterSystems IRIS SOAP or REST service, which registers the app and device with the Identity Manager. It associates a string identifier with the app on the mobile device. You can choose any kind of identifier. For example, you can use the account that identifies the user on your production application. You can register multiple devices using the same identifier. When you register the device, you must provide the information required by the APNS or GCM servers to push a notification to the device.
Once one or more devices have been registered with an identifier, your InterSystems IRIS code can push a notification by sending a notification message to the Identity Manager with the user’s identification. The Identity Manager sends the notifications through a router to one or more Push Notifications operations.
The following illustrates how an app on a mobile device registers with the Push Notifications Identity Manager.
The following illustrates how push notifications are sent to the app on the mobile device. The Identity Manager, GCM Operation, and APNS Operation are provided as built-in components. You can define a router using the Routing Engine and a routing rule.
Push Notifications Operations
InterSystems IRIS provides built-in business operations for Push Notifications. These operations enable you to push a notification to an app on an iOS or Google device. The operations are:
EnsLib.PushNotifications.APNS.Operation—Business operation that sends the push notifications to the iOS Push Notifications server. Each target app requires a TLS certificate. The operation maintains a connection to the APNS server for that certificate. Calls the underlying %Net.PushNotifications.APNS class to send the motification to the APNS server.
EnsLib.PushNotifications.GCM.Operation—Business operation that sends the push notification to the Google Cloud Messaging server. Calls the underlying %Net.PushNotifications.GCM class to send the notification to the GCM server. The GCM operation can send a single notification to multiple devices for the same user and app.
Push Notifications Identity Manager
The Identity Manager allows you to send a push notification to a user without knowing the number or kind of devices that the user has. The Push Notifications Identity Manager maintains a table associating a single ID for a user of a mobile app and associates it with all of the user’s mobile devices. The Identity Manager business process receives messages from other production components. It, typically, sends messages to a router that forwards all GCM messages to the GCM operation and forwards each APNS message to the APNS operation configured to handle the specified TLS certificate.
Sending Push Notifications from ObjectScript
If you are sending Push Notifications from a production component, you can send the notification to the Identity Manager or directly to one of the Push Notifications operations. However, if you are generating your Push Notifications in ObjectScript outside of the production environment, you can use the Push Notifications AppService to get the notification into the InterSystems IRIS environment. This allows you to use the capabilities of the Identity Manager. Note that if you are not using the Identity Manager, your code could also use the %Net.PushNotifications.APNS and %Net.PushNotifications.GCM classes directly.