彗星与 PHP:如何在 PHP 聊天系统中使用 Comet?
我必须使用 Comet 在 PHP 中构建一个简单的聊天系统。
我不知道这个项目的最佳方法是什么。
最好使用的技术(跨浏览器就更好了)是什么,以及如何实现它? 我可以使用哪些已经支持 Comet 的库。 (我不想使用贝叶协议)
我已经为聊天系统运行了一个 PHP 后端,但我需要一些关于客户端和服务器之间交互的想法。
谢谢大家。 致以我的问候。
I have to build a simple chat system in PHP using Comet.
I don't know what would be the best approach to this project.
What is the best technique (cross-browser would be nice) to use, and how to implement it? What libraries can I use that already have comet support. (I don't want to use the Bayeux Protocol)
I already have a PHP backend running for the chat system, but I need some ideas for the interaction between client and server.
Thank you all in advance. My regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能需要查看 WebChat2 该项目使用 comet、AJAX 和自定义 HTTP 服务器通过套接字与 IRC 进行通信。
You may want to look at WebChat2 This project uses comet, AJAX, and a custom HTTP server to communicate with IRC via sockets.
图表 & 长篇大论
不幸的是,没有关于PHP 就在那里,尽管您可能会使用其他平台上的 Comet 服务器来包装现有的后端。
关于此有一个 类似的问题,看起来 FastCGI 是你最好的选择。
chart & Long point-by-point discussion
Unfortunately, there's no information for PHP in there, though you could potentially wrap your existing back-end with a comet server on some other platform.
There is a similar SO question about this, looks like FastCGI is your best bet.
php 与 comet 不太匹配,因为无法拥有轻量级请求处理程序。 您必须为每个连接的用户锁定完整的进程。 它可以适用于很少的用户,但不适用于任何中等流量的情况。
php is not a good match for comet, because there is no way to have light weight request handlers. You would have to lock up a full process for each user connected. It could work with very few users, but not for anything with even moderate traffic.