Start a Project

How to send the push notification using Topic Messaging GCM


“GCM topic messaging allows your app server to send a message to multiple devices that have opted into a particular topic.”


 

Based on the publish/subscribe model, topic messaging supports unlimited subscriptions per app.

The app server sends messages with payloads up to 2KB to the topic.

GCM introduces topic messaging, a way of sending messages to many clients.

An application can create one or more topics and register clients to each topic. Then messages are sent for a specific topic, GCM informing all clients who have been registered for it. This way one can reach a large number of clients, even all of them.

Developers can choose any topic name that matches the regular expression, "/topics/[a-zA-Z0-9-_.~%]+"

 

How to Send the topic messages from the server

GCM topic is very similar to sending messages to an individual device.

The app server sets to with /topics/yourTopicMessage

We can send data messages to a topic by HTTP and XMPP protocols.

HTTP POST Request:

XMPP Message:

Expect up to 30 seconds of delay before the GCM Connection Server returns a success or failure response to the topic send requests.

 

How to Subscribe to a topic

To subscribe to a topic, the client app calls GCM PubSub subscribe() with the GCM registration token and topic name.

How to receive and handle topic messages

The GCMReceiver and GCMListenerService services is simplify use for message handling on Android client apps.

 

 

 

Exit mobile version