What does gcm.send do?

58 views
Skip to first unread message

Chee How Chua

unread,
Jul 16, 2014, 11:37:14 AM7/16/14
to gcm-for-chr...@googlegroups.com
I've gotten chrome.gcm.onMessage.addListener() to work correctly with a curl command.

I don't understand what chrome.gcm.send() does. The documentation says that the message should contain the following properties: messageId, data, timeToLive, and destinationId.

The destinationId is made up of the project number found in the Developers Console appended by "@gcm.googleapis.com".

I guess this sends it to the server but where does it go from there? It doesn't specify the registration ID so the server wouldn't know which client to forward it to.

My understanding of gcm.send() is that it sends a message to a Chrome client. Is this wrong?

Dmitry Titov

unread,
Jul 16, 2014, 2:08:52 PM7/16/14
to Chee How Chua, Google
gcm.send() is sending the message upstream (device-to-server) - to your server which is connected to Google via XMPP. This is how to connect the server. This setup allows not only send messages 'downstream' - from your server to devices (which you already got working) but also send messages the other way around - from the devices to the server. 

You can always use XHR or other method to send something to your server of course, but gcm.send() takes care about intermittent/off network connections, TTL etc.


--
You received this message because you are subscribed to the Google Groups "GCM for Chrome feedback" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gcm-for-chrome-fe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chua, Chee How

unread,
Jul 16, 2014, 7:29:58 PM7/16/14
to Dmitry Titov, Google
Oh I see! That was not mentioned in the documentation (for Chrome devs at least). Thanks!
Reply all
Reply to author
Forward
0 new messages