Jump to content

PHP Ajax Chat Question


AbydosGater

Recommended Posts

Hi,

 

I have been considering making a PHP/Ajax chat room.

 

Im wondering what is the best way of going about this?

 

I have used many Ajax chat scripts that really are instant, but the only way I can think of going about this is by using polling. Having the Ajax check the server every 5 seconds and have PHP load any new messages.

 

Even at 5 seconds it would put strain on the server if there were many users, but only updating messages every 5 seconds doesnt seem very efficient.

 

Most ajax chat scripts I have used are instant, as if they are event based like normal IM Clients.

 

How can this be achieved with Ajax and PHP?

 

Andyyy

Link to comment
https://forums.phpfreaks.com/topic/184440-php-ajax-chat-question/
Share on other sites

Repeatedly poll the server until something happens (pull technology) or have the server tell you when something happens (push technology). Last one is more difficult to implement, but also better on your resources. Search Google for implementation examples.

 

I know a lot of the bigger sites use Comet If you want to just use AJAX, your only real option is to keep polling.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.