长轮询与 Apple 推送通知服务安卓 C2DM [英] Long-polling vs Apple Push Notification Service & Android C2DM

查看:24
本文介绍了长轮询与 Apple 推送通知服务安卓 C2DM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个有一些实时限制的移动应用程序.因此,我转向 stackoverflow 以获得建议 &意见并尝试决定哪个是在运行时更新应用程序状态的最佳解决方案:

I am building a mobile application that has some realtime constraints. Therefore I turn to stackoverflow to get advices & opinions and attempt to decide which is the best solution to update the state of the application while running:

  1. 依靠长轮询或直接连接到我的服务器
  2. 依赖 Apple 推送通知服务和 Android C2DM

除了 APNS 和 C2DM 提供统一的接口在应用程序运行或未运行时推送通知,可以说自定义解决方案(基于长轮询或直连)更灵活,更少依赖Apple & 的延迟Android 队列.

Beyond the fact that APNS and C2DM provide a unified interface to push notification while the application is running or not, one can say that a custom solution (based on long-polling or a direct connection) is more flexible and less dependent on the latency of Apple & Android queues.

据我所知,我认为大多数争论源于保持连接打开与在智能手机上打开连接消耗多少电池的成本比较.

As far as I can see, I think most of the debate stems from the cost comparison of how much battery it consumes to keep a connection opened compared to opening a connection on a smartphone.

因此,我对两件事特别感兴趣:

I am therefore particularly interested in two things:

  • 拥有 APNS 和 C2DM 的经验
  • 有关在智能手机上保持 TCP 连接打开的所有影响的详细信息.

欢迎参考!谢谢!

推荐答案

依赖于 Apple & 的延迟Android 队列

dependent on the latency of Apple & Android queues

我不认为这是真的.这取决于应用程序开发人员和服务器端实现需要多少时间.在我的浏览器客户端收到电子邮件之前,我将电子邮件推送到我的手机.不仅是 Gmail,我的公司电子邮件也是如此.

I don't think that's true. It's up to the app developer and the server side implementation how much time this takes. I get my email pushed to my phone before my browser client gets it. And not just gmail, my corporate e-mail as well.

至于您的问题,您应该使用最有效的方法.或者更好的是,您应该让用户选择使用推送通知或设置轮询周期.

As for your question, you should work with whatever works best. Or even better, you should give the user the option to use push notifications or to set the polling period.

这篇关于长轮询与 Apple 推送通知服务安卓 C2DM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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