views:

1146

answers:

3

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.

A: 

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.

troelskn
This is not an answer to my question. I know PHP has it's issues and I know exactly what you are saying, I am very familiar with this problems. But still this is what I need to use. (Facebook does this without problems, with many users)
Christian Toma
True Christian, but realize that FB does what it does because the backend is implemented in Erlang, not PHP. That is where your problem lies. They actually rolled their own server to specifically handle these kinds of requests.
ryeguy
+2  A: 

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.

Tim Sylvester
+1  A: 

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

shambleh
Thank you, I will check it out.
Christian Toma
No problem. It is pretty responsive and should scale well.
shambleh