Different "from:" values received from the GCM CCS server upstream msg from the same client
I am using the GCM demo app provided by google ( repository url ).
When receiving upstream XMPP messages on my application server, the sequential tokens received from the same client are distinguished by the " from " key , how should this be?
From what I understand, the " from " key should always point to the static GCM registration ID received by the client and therefore should not change (at least for every upstream message!).
Here are 3 sequential json-converted upstream messages that I receive from the application:
{u'category': u'com.google.android.gcm.demo', u'time_to_live': 86400, u'from': u'djrWhYFOLtE:APA91bE4kY9ZdM3N0RAQMJFqedDuTFQsTU6sdhbvJ-zEIWTwzw0kFLs_B05XZ-TgH_5y21VgqAXpWig59EZCSAaSBWKVjUFs-zFLG51uygvWMG6LBh_39IM', u'message_id': test1'}
{u'category': u'com.google.android.gcm.demo', u'time_to_live': 86400, u'from': u'djrWhYFOLtE:APA91bHLqazSKrZGUUEPvMkIKdtWCVIxhdYILfPLeguPR_yDUrProRsCfeP3LQiFzR1o0-Ha-BUMor6pTxKuWmUr9zpE6hIZGEkDV2pcQDJSZUKH3DX91wE', u'message_id': test2'}
{u'category': u'com.google.android.gcm.demo', u'time_to_live': 86400, u'from': u'djrWhYFOLtE:APA91bHAROejFamp-8qwFddOKmUl_EYc_A9HdwnB8ojkUIRX-5kFCjHsnIDQIFa-kWMOdE3NpqU643nTrQnzPFcswTFgd7wBo0KnAub29EEyGP3R01njxz8', u'message_id': test3'}
Is this the expected behavior or am I getting something wrong?
Any help is greatly appreciated.
Thank!
source to share
So, after a little more research and investigation of the problem, it seems that the From: key usually takes on a different meaning for each upstream message received from the device.
Also sometimes when sending a notification to the device (using the registration ID taken from the "From:" key), GCM responds with a message Nack
indicating that the device has an unregistered one ("DEVICE_UNREGISTERED")
, so I think Google will often revoke the registration ID inside "FROM:" after some time ...
What I ended up with was to send the actual token received by the client application from GCM to the server in an upstream message and completely ignore the "From:" key, as this is unexpected behavior. So far, I haven't had any problems with this approach.
Hope this helps someone :)
source to share