How do we have the Server write data into clients DIV?

Hi,

We want to have a Web Chat type system, where as users in a discussion type a message the server auto writes this message from user X to all other people who are looking at that Web page for which Web page user X has typed a message, into the DIV id associated with that message.

We know how to this via AJAX & Php when the action is taken by the people on that Web page, what we are looking for is how to have AJAX & Php write data into DIV ID of users on that Web page when they have not taken any actions but user X has taken an action by posting a message.
So basically it is to create a AJAX Php based Web chat.

How do we best implement server writing via AJAX & Php into users on same Web page?

Thanks,
Dean

Have a setInterval() call in the page that checks the server for changes and updates them into the page

You might also have a look at websockets – browser support is pretty good. It’s basically like a usual HTTP request, only that the connection doesn’t close after the response is received.

Well I was looking for a method where the Server could write into clients without a JS loop on client side continuously pulling the server. But that setInterval() maybe a good, if not only, fall back option.

Do you know of any Big Sites, that are using this method to enable Web chat type activity in a Big way?
Put another way, do you think that this method has limitations on how Big the service can get?

Yes, this is what I had in mind.
But I was hoping there would be some sample Code to look at for quick implementation start?
Do you have sample code for this Web sockets for even a simple Web chat or Web live messaging service?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.