Push Notifications
PubNub makes it easy to deliver APNS and/or GCM push notifications. Ideally, clients will be connected to the PubNub network in order to receive published messages in realtime. However, there are situations where this is not always possible (e.g. background processing in iOS), so the Mobile Push Gateway add-on makes it easy to fall back to APNS and/or GCM push notifications. APNS push notifications work with Safari and Mac OSX. GCM push notifications can be configured to work for Chrome.
A common misconception is to mistake subscribing to channels with receiving push notifications for that channel. A user does not need to be subscribed to a channel in order to receive push notifications for it; the only requirement is that their devices have been registered to receive push notifications for the channel. For example, a user subscribed to the channel ‘my_channel’ will not receive push notifications for ‘my_channel’ unless their devices have been explicitly registered to receive push notifications for ‘my_channel’.
Anytime a message is published onto a channel containing a specifically formatted payload (key:value pair) for Apple or Google, PubNub will recognize the published message contains a push notification payload and will proceed to hand the contents to APNS or GCM along with all of the device_ids registered to receive push notifications on that channel.
Further learning:
- Push Notification section of the knowledge base
- Mobile Push Gateway documentation