Reputation: 412
I have a hybrid MobileFirst application. Planning to integrate Push Notification. The approach is backend will call an Adapter with array object which will have user-id and message for push notification. array count will be 100. And every 5 minutes backend will call this adapter with 100 counts in the array.
The Adapter will parse the array and get the getUserNotificationSubscription then call notifyAllDevices for each user id in the array.
Array Object looks like below
{
"notifications": [
{
"userId": "userid",
"message": "Push Notification Message",
"notificationType": "Type of Notification",
"lineOfbusiness": "1",
"issueDate":"",
"uniqueIdentifier":"useruidd"
}
]
}
My understanding is once you call the notifyAllDevices, the API will add the notifications in "Notification State Database" and iOS Dispatcher handles the connections between APNS server and Worklight Server.
I read a note in Apple APNS documentation for best practices for managing the connections with APNS server,
Keep your connections with APNs open across multiple notifications; don’t repeatedly open and close connections. APNs treats rapid connection and disconnection as a denial-of-service attack. You should leave a connection open unless you know it will be idle for an extended period of time—for example, if you only send notifications to your users once a day it is ok to use a new connection each day. You can establish multiple connections to APNs servers to improve performance. When you send a large number of remote notifications, distribute them across connections to several server endpoints. This improves performance, compared to using a single connection, by letting you send remote notifications faster and by letting APNs deliver them faster
I want to understand how this MobileFirst iOS Dispatcher works. And its follows the best practices suggested by Apple? Not able to find in-depth information in IBM info center documentation.
Upvotes: 1
Views: 113
Reputation: 2681
IBM MobileFirst follows the best practices suggested by Apple. IBM MobileFirst creates persistent socket connections with APNS.
To improve performance, MobileFirst creates 3 persistent socket connections with APNS by default. This value can be tuned by the user using the JNDI property :
push.apns.connections
The persistent connections are not closed by IBM MobileFirst. However, if the user wishes to close it gracefully ( if there is an extended idle time), they can do so using the JNDI property
push.apns.connectionIdleTimeout
Also, if there are external factors ( such as firewalls) that close the connections opened with APNS, MobileFirst recreates the connections ( as defined in the JNDI or 3 by default) and sends remote notifications over these connections. If user's firewall settings are configured to close idle socket connections, then they can use the idletimeout JNDI property to gracefully close the sockets before the firewall terminates them.
Upvotes: 2