How to implement a real fast web chat with PHP?
Has anybody ever wonder why Facebook chat is just so really really fast? even in IE without WebSocket.
Isn\'t
The instantaneous chat you're describing is generally acheived by a something called "Long Polling" or, if we're talking about AJAX, "Comet" (Wikipedia talks about it). Polling tends to strain Apache servers, but there are some specialized servers to deal with it like APE. I'm not sure but I think you can do the same with NodeJS and NGINX handles the stress pretty well.
Here's an article here about how to implement a long polling chat with PHP jQuery and AJAX.
Best of luck, and I hope it helped!
I agree with @joseph-szymborski although it would make sense to start looking at WebSocket solutions which fallback to WebSockets via Flash and/or long-polling.
Here are some relevant SO questions:
If you want to work with PHP or are on shared hosting then I'd recommend looking at a hosted realtime web solution.
You might want to consider Node.js to serve the clients in 'real time' since Long polling with PHP/AJAX may cause strain on your server. But the implementation itself is an uphill task. Just saying. Long polling with PHP/AJAX may cause strain on your server.
My typical theoretical implementation of the same: