与......不同:从同一个客户端从GCM CCS服务器上游msg收到的值 [英] Different "from:" values received from GCM CCS server upstream msg from the same client

查看:123
本文介绍了与......不同:从同一个客户端从GCM CCS服务器上游msg收到的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是由Google提供的GCM演示应用程序(存储库URL )。



在我的应用服务器中接收上游XMPP消息时,从同一客户端收到的连续令牌在其 键中有所不同,这是它应该是?



据我所知, from 键应始终指向由客户端获得的静态GCM注册ID,因此不应更改(在)

这里有3个连续的上游消息转换为json我从应用程序接收:

  {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'从 ':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:AP A91bHAROejFamp-8qwFddOKmUl_EYc_A9HdwnB8ojkUIRX-5kFCjHsnIDQIFa-kWMOdE3NpqU643nTrQnzPFcswTFgd7wBo0KnAub29EEyGP3R01njxz8' ,u'message_id ':TEST3'}



这是预期的行为还是我误会了什么?



任何帮助都非常感谢。



谢谢!

解决方案

好了,经过一点点挖掘和调查问题后,似乎From:键通常会在接收到的每个上游消息中采用不同的值从设备。

有时在向设备发送通知时(使用从From:键获得的注册ID),GCM会以 Nack 消息,表明设备未注册(DEVICE_UNREGISTERED),所以我猜Google经常会在某个时间之后使FROM:内的注册ID无效已经过去了。

我最终做的是将实际的令牌(由客户端应用程序从GCM接收)发送到上游消息中的服务器,并完全忽略From:因为它有意想不到的行为。到目前为止,我还没有采取这种方法的任何问题。



希望这可以帮助某人:)


I'm using the GCM demo application provided by google (repository URL).

When receiving upstream XMPP messages in my app server, consecutive tokens received from the same client differ in their "from" key, is that how it's supposed to be ?

From what I understand, "from" key should always point to a static GCM registration ID obtained by client and thus should not change (at least per each upstream message !).

Here are 3 consecutive upstream messages converted to json I recieve from the app:

{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 mistaking something ?

Any help is greatly appreciated.

Thanks !

解决方案

Okay so after a little bit more digging and investigating the issue, seems the "From:" key usually takes a different value upon 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 Nack message, indicating the device has unregistered ("DEVICE_UNREGISTERED"), so I guess Google often invalidates the registration ID inside the "FROM:" after sometime has passed.

What i ended up doing was to send the actual token, received by the client app from GCM, to the server in an upstream message and completely neglecting the "From:" key since it had unexpected behavior. I haven't had any issues so far taking this approach.

Hope this helps someone :)

这篇关于与......不同:从同一个客户端从GCM CCS服务器上游msg收到的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆