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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.