Comet & PHP: How to use Comet with a PHP Chat System?

给你一囗甜甜゛ 提交于 2019-11-27 05:41:55

问题


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.


回答1:


You may want to look at WebChat2 This project uses comet, AJAX, and a custom HTTP server to communicate with IRC via sockets.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/1190744/comet-php-how-to-use-comet-with-a-php-chat-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!