After writing the post about my letdowns with Google Cloud Messaging, I set out to find an alternative way to send push notifications reliably on Android.
I stumbled upon numerous SaaS push notification services, such as Parse, Boxcar.io, UrbanAirship, PubNub, and even AWS SNS. Unfortunately, I discovered that all of these services piggyback on GCM, simply making it easier to develop push notifications for iOS, Android, and Windows Phone at the same time, instead of implementing backend calls to 3 separate APIs. The apps still need to register with GCM (and fail repeatedly with
SERVICE_NOT_AVAILABLE), and the heartbeat interval will still prevent users from receiving push notifications, because the underlying socket is still handled by GCM.
I was not able to find a single push notification service that didn't depend on GCM. So I founded my own push notification gateway called Pushy.
Pushy is a standalone push notification gateway, completely independent of GCM. It maintains its own background socket connection, just like GCM, to receive push notifications. The underlying protocol is MQTT, an extremely light-weight pub/sub protocol, utilizing very little network bandwidth and battery. We chose MQTT after comparing multiple protocols, including WebSockets and XMPP. Also, the fact that Facebook chose to implement its push notifications using MQTT is highly-convincing.
The entire Pushy backend is built with Node.js and MongoDB on top of Amazon Web Services. It scales automatically to support all the concurrent devices.
Pushy is very similar in its architecture to Google Cloud Messaging. Your Android app registers with Pushy and receives a registration ID, which it then sends to your backend server to store for later. When it's time to send a push notification, your backend server sends the registration ID to Pushy via a simple JSON REST API along with the push payload, and in less than 1/4 of a second, the push will arrive. The workflow is the same as with GCM.
Since Pushy doesn't rely on GCM or Google in any way, it's also an excellent way to deliver push notifications in China, where Google services are blocked.
Drop-In Replacement for GCM
A huge advantage of Pushy is that it's a drop-in replacement for Google Cloud Messaging. The code for sending a push notification (from the server) and receiving a registration ID is almost identical for GCM and Pushy. This makes it super easy to switch to Pushy after implementing GCM and having to ditch it for its instability.
Try it out for free!
Want to give Pushy a try? Get started with a free developer account, no payment method necessary.
Let me know what you think about Pushy in the comments!