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 only way is to setInterval in JS to check for new messages? But I feel it (Facebook chat box) like having instant reaction.
How to implement such great thing with PHP?
PHP Live! is a PHP and MySQL powered live chat software for websites. PHP Live! enables your website visitors to contact you instantly via live chat directly from your webpages. It's simple to configure, easy to use with plethora of live chat features. We offer two types of Live Chat Solutions: Download or On Demand.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With