tags:

views:

69

answers:

3

Hi,

I have a small requirement in PHP as below. Some thing like chat.

For eg there are 2 users A & B.

When "A" clicks on "Chat" link. "B" should automatically gets one javascript popup.

Is there any way of doing this except following. - One JS script runs continuously with AJAX. I dont want to happen client-server interaction continuously.

Is there any way for server sending status to browser directly?.

Thanks in advance.

A: 

Are you worried about wasting bandwidth? Why not try out XMPP? There are php libraries as well.

Shoban
A: 

You can either use polling (the JavaScript client keeps checking with the server every once in a while using AJAX) or use something like a Java Applet which would establish a separate connection with server and keep it on for communicating back and forth. If you use a Java Applet, then you should probably use server side Java as that would be the most effective.

Ralph Stevens
Comet can either be implemented using AJAX + polling or using Java Applets. It is not a separate technology.
Ralph Stevens
+2  A: 

You can do it the other way, instead of Ajax use Comet. That way the server pushes data to the client without the client expecting it. The Facebook chat uses this technique.

pablasso
This is an excellent solution. Thank you
Venu