希望建立一个基于网络的聊天。有什么建议吗?
我正在寻找构建一个基于网络的聊天应用程序。我的主要想法是使用 AJAX 并在集中式服务器之间来回传输 XML 消息(用于同步)。
但是,我最近遇到了 XMPP,并且想知道将其用作基于 Web 的可行性如何。聊天客户端和服务器,以及用 PHP 实现它是多么容易。
我真的很希望这里的专家提供一些关于我可以采取的其他技术方法的意见。聊天必须完全基于网络,但将来可能会移植到 iPhone 应用程序。
I was looking to build a web based chat application. My primary idea was in the direction of using AJAX and transferring XML messages to-and-fro a centralized server (used for synchronization)
However, i recently came across XMPP and would like to know how feasible it is to use it as a web based chat client and server, and how easy it is to implement it in PHP.
I would really like some inputs from the gurus here about any other technical approaches that i can take. The chat has to be completely web based, but might be ported to an iPhone application sometime later in the future.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看基于浏览器的聊天示例 Jaxl 库 。 JAXL(Jabber XMPP 库)是用 PHP 编写的,您可以根据您的用例扩展打包的示例。
查看这篇博文 了解如何在本地系统上设置示例浏览器聊天应用程序。
Checkout this browser based chat examples of Jaxl library . JAXL (Jabber XMPP Library) is written in PHP and you can extend the packaged sample examples for your use case.
Checkout this blog post on how to setup the sample browser chat application on your local system.
如果您确实想构建简单快速的东西,请使用 memcache 作为队列。
当用户 A 发送消息时,将其放入用户 B 的队列中,用户 B 定期使用 AJAX 进行轮询。
您还可以尝试使用 node.js,它非常适合聊天应用程序。
我也实现了 XMPP,但我发现要让它正常稳定地工作需要太多工作。
If you really want to build something simple and fast, use memcache as a queue.
When user A sends a message, put it in a queue for user B who periodically polls using AJAX.
You could also experiment with node.js which is great for chat applications.
I've implemented XMPP as well and I found it to be too much work to have it work properly and stable.