GCM:如何避免节流 [英] GCM: how to avoid throttling

查看:200
本文介绍了GCM:如何避免节流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid系统需要频繁更新发送到一个应用程序的平板电脑(亭始终连接到WiFi和电源插头)。
GCM-HTTP(//developer.android.com/google/gcm/http.html)工作正常,但在某些情况下,可能发生的是一个单一的装置接收许多通知触发此处所描述的众所周知的节流问题(//显影剂。 android.com/google/gcm/adv.html#throttling)。这是一个问题,因为该通知中的有效负载是为系统非常重要。 什么是prevent这个最好的解决办法?

My android system needs to send frequent updates to an app for tablet (a kiosk always connected to wifi and power plug).
GCM-HTTP (//developer.android.com/google/gcm/http.html) works fine but in some cases it can happen that a single device receives many notifications triggering the well- known throttling issue described here (//developer.android.com/google/gcm/adv.html#throttling). This is a problem since the payload in the notification is of great importance for the system. What is the best solution to prevent this?

    在服务器
  • 实现一种服务,组的通知到相同的设备,并与一个有限的频率拍摄它们。
  • 使用一个XMPP服务。我想用GCM-XMPP(//developer.android.com/google/gcm/ccs.html),但你需要在一个白名单要签名,所以我不认为每个人都已经可以使用它。作为替代方案,我应该使用aSmack或Quickblox作为建议在这里(<一href="http://stackoverflow.com/questions/4769020/android-and-xmpp-currently-available-solutions">Android和XMPP:目前可用的解决方案的),并在这里(<一href="http://stackoverflow.com/questions/18953114/xmpp-android-better-way-to-implement-the-chat-application-using-xmpp">Better方法来实现使用XMPP Android上的聊天应用程序?)分别是多少?
  • 在(//thinkandroid.word$p$pss.com/2010/03/27/incorporating-socket-programming-into-your-applications/)描述实现基本的套接字连接?在这种情况下,我必须考虑到连接的可能性得到暂时失去了什么?
  • implement in the server a service that groups notifications to the same device and shoot them with a limited frequency.
  • use a XMPP service. I would like to use GCM-XMPP (//developer.android.com/google/gcm/ccs.html) but you need to be signed in a whitelist so I don't think everyone can already use it. As alternatives should I use aSmack or Quickblox as advised here (Android and XMPP: Currently available solutions) and here (Better Way to implement the chat application using XMPP on Android?) respectively?
  • implement a basic socket connection as described in (//thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/)? In this case I have to take into consideration the possibility of the connection getting momentarily lost?

解决方案: 我找到了解决我的问题,那就是XMPP协议。一开始,我在平板电脑应用程序中实现aSmack并配置的ejabberd服务器本地运行。的执行工作已经pretty的方便。 过了几个星期,我收到一个邮件从谷歌的GCM-XMPP,这是更快的应用程序中嵌入和作品超精细!

SOLUTION: I found the solution to my question, that is XMPP protocol. At the beginning I implemented aSmack in the tablet application and configured an eJabberd server running locally. The implementation has been pretty easy. After a couple of weeks I received a mail from Google for the GCM-XMPP, that is even quicker to embed in the app and works super fine!

推荐答案

也许设置time_to_live为0。

Maybe setting time_to_live to 0.

http://developer.android.com/google/gcm/adv.html

指定的到期日期的消息的另一个优点是,的 GCM将与0秒的time_to_live值从不油门消息即可。换句话说,GCM将保证尽力而为对于必须消息交付机不可失,时不再来。请记住,0 time_to_live值表示不能立即交付将被丢弃。但是,因为这样的邮件永远不会存储,这提供了一个发送通知的最好的延迟的消息。

"Another advantage of specifying the expiration date for a message is that GCM will never throttle messages with a time_to_live value of 0 seconds. In other words, GCM will guarantee best effort for messages that must be delivered "now or never." Keep in mind that a time_to_live value of 0 means messages that can't be delivered immediately will be discarded. However, because such messages are never stored, this provides the best latency for sending notifications."

这篇关于GCM:如何避免节流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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