Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement a real fast web chat with PHP?

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?

like image 756
jondinham Avatar asked Nov 18 '11 02:11

jondinham


People also ask

What is PHP live chat?

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.


1 Answers

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!

like image 158
Joseph Szymborski Avatar answered Sep 21 '22 11:09

Joseph Szymborski