iPhone 创建聊天应用程序

发布于 2024-08-03 14:58:33 字数 206 浏览 3 评论 0原文

我想在 iPhone 上创建一个聊天类应用程序。我知道我将如何实现一个轮询模型,其中 iPhone 会轮询服务器以查看是否有消息到达,如果有消息可以检索它们并将其显示给用户。然而,我对推送模型更感兴趣,其中服务器将新消息推送到 iPhone 并将其显示给用户。我很难弄清楚如何在手机上打开一些永久连接来侦听传入的消息...任何建议或评论都将受到赞赏..

谢谢

丹尼尔

I want to create a chat sort of application on the iphone. I know how I would go about implementing a poll model, where the iphone would poll the server to see if any messages have arrived and if they have it can retrieve them and show them to the user. However im more intersted in a push model, where the server pushes new messages to the iphone and it displays it to the user. The part im having a hard time figuring out is how to go about opening some permanent connection on the phone that will listen for incoming messages...Any suggestions or comments would be appriciated..

Thanks

Daniel

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

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

发布评论

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

评论(1

半枫 2024-08-10 14:58:33

iPhone 3 SDK 内置了推送支持。基本上,所有需要推送的消息(来自所有应用程序)都会发送到 Apple 的服务器,该服务器与用户的 iPhone 保持持久连接。好处是您不必担心它,即使您的应用程序未运行(例如,从主屏幕)也可以获取更新。缺点是你的数据必须通过苹果的服务器。

The iPhone 3 SDK has push support built in. Basically, all messages that need to be pushed (from all apps) go to Apple's server, which maintains a persistent connection to the user's iphone. The upside is that you dont have to worry about it and your app can get updates even when its not running (so like, from the home screen). The downside is that your data has to go through Apple's server.

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