Back in 2010, Google introduced C2DM (Cloud to Device Messaging) as a way to push messages from cloud to Android powered devices. This service was eventually replaced by GCM (Google Cloud Messaging). C2DM is now deprecated & the service will be shut down completely on 20 Oct 2015.
The GCM focuses on addressing some of the problems in C2DM as mentioned below:
GCM has progressively added features over the years. The latest version as of this writing supports the following features.
Supports Android, iOS & Chrome platforms. The advantage here is that app server needs to communicate with one server viz, GCM rather than multiple servers e.g., APNS. iOS apps can communicate via APNs bridge or independently. Chrome apps & extensions can leverage messaging services.
Groups of up to 20 devices can be created. It is easy to add/remove devices from the group. This is useful to message/sync connected devices belonging to the same user.
Allows to send messages only to devices that have opted-in to a particular topic. This uses a PubSub model. Receivers subscribe to a topic. Producers publish to a topic. For example, users of a sports app could opt-in to receive messages regarding 20-20 format Cricket matches only.
In addition to using HTTP for downstream messaging, XMPP can be used for duplex (downstream & upstream) communication. On the server, the asynchronous nature of XMPP allows you to send more messages with fewer resources. On the device, since the connection is reused for sending/receiving,this improves battery life.
There are several aspects that can be used to control the lifespan of the message. Message priority can be changed. The TTL option decides how long the message is saved on the GCM server before it is discarded (message is stored until it is delivered to the device). The GCM server will wait until the device wakes up, before delivering the message, if delay-while-idle option is set.
A collapsible message is a message that may be replaced by a new message containing the same collapse key if it has yet to be delivered to the device. Ping messages which request the device to sync/refresh its data or breaking news message in a news app are such candidates.
GCM supports sending multicast messages for up to 1000 devices using a single request. This can conserve app server resources.
Multiple app servers can send messages to the same app on a device by sharing the registration id. For example, content aggregation apps can receive messages from multiple content sources.
Google’s cloud messaging has come a long way from simplistic downstream messaging to the sophisticated messaging system it is today. It would be nice if the limits applicable on the number of topic subscriptions & group size are removed.
Resources that can help you start, build and support your digital journey.Find out more
Let's craft delightful digital experiences together.
Tell us more about your vision.