在移动设备/应用程序中使用 HTTP 推送可能会出现哪些问题?

发布于 2024-11-30 13:58:22 字数 358 浏览 1 评论 0原文

我必须为一些移动设备制定推送通知计划,其中推送尚未得到 C2DM / APNS / BES 等正式支持。 MQTT 也是一个不错的选择,但我无法获得适合我所需平台的 MQTT 客户端。 (Blackberry Playbook,仅限 ActionScript)

回到基础知识,我可以选择长轮询和流式传输。使用高保持活动值进行流传输对我来说似乎很好,因为移动应用程序(它不是浏览器)和服务器代码的开发都在我的控制之下。为了保持连接打开,我只需要偶尔 ping 服务器即可。

采用这种方法我可能会面临哪些问题?我知道这会不断打开从设备到服务器的 HTTP 连接。如果持续打开服务器连接,移动设备的电池寿命会很快耗尽吗? ...毕竟数据没有被传输,只需保持连接打开...对吗?

I have to devise a push notification plan for some mobile devices where push is not yet officially supported by C2DM / APNS / BES ,etc. MQTT was also a good option but I could not get an MQTT Client for my required platform. (Blackberry Playbook, ActionScript only)

Going back to basics, I had the options of Long Polling and streaming. Streaming using a high keep-alive value seems good to me, as the development of the mobile app (it is not a browser) and the server code are both in my control. To maintain the connection open, I just need to ping the server occasionally.

What issues I may be facing in this approach ? I understand this would constantly open an HTTP connection from the device to the server. Would the battery life of mobile device drain quickly just by persistently opening a server connection ? ...Afterall the data is not being transferred, just by keeping the connection open...right ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

东京女 2024-12-07 13:58:22

您可能需要考虑城市飞艇或看看这个实时技术指南

如果实时性真的很重要,我说的是秒或毫秒,那么使用 WebSocketsHTTP Streaming 是您的最佳选择,因为它们会在更新可用时立即提供更新。这类事情最适合用户在合理的时间内积极使用的应用程序,他们需要即时通知或与其他人协作/聊天。

考虑到长期技术考虑,WebSocket 可能是一个更好的标准,因为它们是客户端(移动、Web、桌面)和服务器之间全双工双向通信的第一个标准。

You might want to consider Urban Airship or take a look at this realtime technologies guide.

If realtime really matters, I'm talking about seconds or milliseconds, then a realtime web technology using WebSockets or HTTP Streaming is your best option as they deliver updates the instant they are available. This sort of thing is best suited to the sort of application that a user is actively using during a reasonable period of time where they need instant notifications or are collaborating/chatting with others.

WebSockets are probably a better standard to be using with longer term technology considerations in mind since they are the first standard for full duplex bi-directional communication between a client (mobile, web, desktop) and server.

不奢求什么 2024-12-07 13:58:22

您找不到适用于哪些平台的 MQTT 客户端? http://mqtt.org/software 列出了我能想到的几乎所有语言的客户端,而且比我还多。我想麻烦使用。 mosquitto C 客户端库非常可移植。

对于电池寿命,这实际上取决于您在保持连接之间所做的事情......

What platform could you not find an MQTT client for? http://mqtt.org/software lists clients in just about every language I can think of and more than I'd like to bother using. The mosquitto C client library is very portable.

For battery life, it really depends what you're doing between the keepalives...

厌味 2024-12-07 13:58:22

如果您的应用在网络状况不佳的国家/地区运行,那么让所有客户端保持连接开放可能会给他们的基础设施带来压力(假设您很受欢迎)。

电池寿命是另一个考虑因素,是的,许多设备在保持空闲无线电/3g 连接打开方面效率不高,而且它消耗电池的速度比不打开连接要快得多。

If you app runs in a country where the network isn't in the best shape, then having all your clients keep a connection open can put strain on their infrastructure (assuming you are that popular).

Battery life is the other consideration, yes, a lot of devices aren't that efficient in keeping an idle radio/3g connection open and it drains the battery a lot faster than not having a connection open.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文