CREATING THE PUSH NOTIFICATION PROVIDER

A push notification provider is an application written by the application's developer to send push notifications to the iOS application through the APNs. Here are the basic steps to send push notifications to your applications via the APNs server:

  1. Communicate with the APNs server using the SSL Certificate you created earlier.
  2. Construct the payload for the message you want to send.
  3. Send the push notification containing the payload to the APNs.

The APNs is a stream TCP socket that your provider can communicate with using a SSL secured communication channel. You send the push notification (containing the payload) as a binary stream. Once you are connected to the APNs, you can send as many push notifications as you want within the duration of the connection.

image NOTE Refrain from opening and closing the connections to the APNs for each push notification that you want to send. Rapid opening and closing of connections to the APNs will be deemed a denial-of-service (DOS) attack and may prevent your provider from sending push notifications to your applications.

The format of a push notification message looks like Figure 19-24 (taken from Apple's documentation).

image

FIGURE 19-24

NOTE For more details on APNs, refer to the Apple Push Notification Service ...

Get Beginning iOS 5 Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.