- What’s the difference between PubNub publishing and sending push notifications?
- How is subscribing for real-time messages different from registering for push notifications?
- How do you format the message payload to target real-time and push notification delivery with one publish?
- How do you perform high-level debugging when implementing push notifications?
We’ve also written a couple of tutorials around APNS, GCM, and PubNub that will get you started nice and quick.
- Setting up GCM, APNS, and native publish/subscribe for push notifications
- Broadcasting desktop push notifications for Google Chrome
What’s the difference between PubNub publishing and sending push notifications?
With PubNub, we send and receive messages over channels (ie. “topics”), and that gives you lots of different options on the wide variety of mobile gateways in addition to PubNub’s Data Stream Network. The PubNub mobile gateway connects directly to Google, Apple, and Microsoft for GCM, APNS, and Windows notifications.
By subscribing to a PubNub channel, all you have to do is issue a subscribe call on the channel you want to connect to. If you want to receive push notifications via the APNS gateway, you use a device registry function that’s available with the iOS SDK. With GCM, you have the Android SDK.
How is subscribing for real-time messages different from registering for push notifications?
Data is received differently based on the state of the application or where the user is sitting on the app. For example, if you were to register on an APNS channel on Apple’s network, but if we also subscribe to a PubNub channel, we’ll receive the data on both of the networks depending on the state of the application. If we’re in the application and we’re live, the user will receive the data via PubNub, in real time. However, when the app is in the background, it’ll arrive when APNS sends it (Apple provides no guarantees).
How do you format the message payload to target real-time and push notification delivery with one publish?
With a single API method, we can broadcast across a wide variety of notification networks simultaneously. You can do this by defining specific keys in your payload, and in the payload, you would identify the Apple key, the GCM key, or the Windows gateway key. In that object, you paste the information that Apple is expecting to receive based on their standard docs.
Within each specific gateway, there are certain restrictions with data lengths. The entire message can be up to 32kb on PubNub, while APNS is 2kb, and GCM/Windows is 4kb.
We also have PubNub Office Hours at our San Francisco HQ, every Wednesday from 2-5pm, where you can get your real-time questions answered in real time. Give us a heads up at firstname.lastname@example.org and let us know you’re coming.