长轮询 vs Apple 推送通知服务和长轮询安卓C2DM
我正在构建一个具有一些实时限制的移动应用程序。因此我转向 stackoverflow 寻求建议和帮助。意见并尝试决定哪个是在运行时更新应用程序状态的最佳解决方案:
- 依赖长轮询或直接连接到我的服务器
- 依赖 Apple 推送通知服务和 Android C2DM
除了 APNS 和 C2DM 提供统一的事实之外无论应用程序是否运行,都可以通过接口推送通知,可以说定制解决方案(基于长轮询或直接连接)更加灵活,并且更少依赖于 Apple 和 Apple 的延迟。安卓队列。
据我所知,我认为大多数争论源于保持连接打开与在智能手机上打开连接所消耗的电池电量的成本比较。
因此,我对两件事特别感兴趣:
- APNS 和 C2DM 的体验
- 详细了解在智能手机上保持 TCP 连接打开的所有影响。
欢迎参考!谢谢!
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:
- rely on long-polling or direct connection to my server
- rely on Apple Push Notification Service and Android C2DM
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:
- Experiences with APNS and C2DM
- Details on all the implications of keeping a TCP connection open on a smartphone.
References welcome! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为这是真的。这取决于应用程序开发人员和服务器端实现需要多少时间。在我的浏览器客户端收到电子邮件之前,我已将电子邮件推送到手机上。不仅仅是 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.