gcm on socket reconnect event

50 views
Skip to first unread message

Keven Wang

unread,
Nov 13, 2014, 2:23:03 PM11/13/14
to gcm-for-chr...@googlegroups.com
I'm setting my messages' ttl to 0, so that it will not be throttled by GCM server. When a user's computer wakes up from sleep, or reconnects to internet, I want to trigger a sync function manually with my own server, to fetch messages missed while idle.

Is there a way to detect when gcm re-establishes connection? (wakes up from idle state)

Filip Gorski

unread,
Nov 13, 2014, 5:56:54 PM11/13/14
to gcm-for-chr...@googlegroups.com
Hi, Keven,

chrome.gcm API currently does not offer a way to tell your application that GCM was reconnected.

Setting TTL = 0 means that your messages will not be throttled, but will also not be delivered if your client is not connected.

Did you consider using collapsible messages? Using collapse key you make sure that you don't get throttled, and the old message can be replaced with a new message posted with that key. That way you can always post those without triggering throttling. http://developer.android.com/google/gcm/adv.html

You can also rely on the onMessagesDeleted event, which is GCMs way of telling your client that some messages were dropped. (of course then TTL should be more than 0).

thanks.
Filip

Keven Wang

unread,
Nov 13, 2014, 6:34:53 PM11/13/14
to gcm-for-chr...@googlegroups.com
Thanks. My issue is that if I were to use collapse key, I'd need 100's of keys per user, with the way currently implemented. I read on gcm website, that an app is only allowed 4 collapse keys, which is not enough for me. 

Is this true?
Reply all
Reply to author
Forward
0 new messages