Topic Messaging
Topic Messaging is one of the paramounts for using GCM. Topic is a feature that enables users to receive notification on particular topics as per their subscription. For instance in a news app, subscribing a particular topic – sports, he will receive only news feeds that match sports.
How it works is that the app server sends a message to multiple devices based on the subscribed topic. The app server sends messages to the topic that weigh up to 2 kb and are routed by GCM to the right devices. The server limitedly supports upto one million subscriptions per app. GCM effortlessly lets developers configure when to subscribe topic, when to send messages, and how notification works while it reaches the client app.
Send Notification to other devices within the app
Google Cloud Messaging switches on the possibilities of messaging in all feasible ways. It lets developers to send messages to client app in three ways – messaging single devices, messaging groups of devices, or messaging subscribed devices to particular topics.
Device Group Messaging
Device group messaging enables app server to send a single message to multiple devices that belong to one group of an app. The term ‘Group’ means a bunch of devices that belong to a single user/developer. Here a common notification key is shared for all devices, which is the token that GCM uses to send out messages to all devices in the group. The highlight of device group messaging is that the users can handle notification or message in a single device. That is when you have smartwatch, mobile and tablet; it is activated only on a single device at a time. How it works is that a message is sent to the common notification key, the token of GCM. Using the token, GCM drives messages to all devices that subscribed to the same token.
Downstream and Upstream Messaging
Downstream messaging is a concept to alert user via pop-up, notification, or message even before the user open the app over GCM. Upstream messaging is the polar of downstream messaging in which data are sent back to server using GCM. Both messaging options are reliable and battery efficient.
Works both on Android and iOS
When Google released GCM service, it was meant only for Android support. Making a strong presence in the app world, Google has updated the service so that iOS apps will have a go with it. All you need to do with the server is implement GCM’s interface for sending both Android and iOS notifications. This will make developers to forget the more complicated interface of APNS.
The advantage of GCM is that your server only needs to implement GCM’s interface for sending both Android and iOS notifications. The interface of APNS is somewhat more cumbersome and harder to work with. Additionally, GCM works with languages – Objective-C and Swift, which will administer more room for developers to write code in their own style. GCM also lets you to set up your CocoaPods dependencies.
Following is the architecture diagram of iOS push notification on the Google cloud platform.