O'Reilly logo

Beginning iOS 5 Application Development by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required