This is where there is a need for some "magic".
In the case of Stuart, he wrote a "fastcgi" script. Basiacally, this
handles the Ajax calls.
Each call uses "long polling": the server is not responding directly.
Instead, it keeps the connection open to the fast-cgi script.
In order to know how many users are online, you just have to count how many
connections are open to the fastcgi script.
Then, since the connections are open, still waiting for a reply, the
fastcgi script just forwards the message it receives on all open
There are other ways to do this. I've been doing this in a pure PHP way
with Xaja (without the need of using fastcgi, with just PHP and Apache).
There is an explanation going on here:
Maybe it will make things more clear.
On Tue, 21 Apr 2009 12:10:48 -0400, tedd <tedd.sperl...@gmail.com> wrote:
> At 5:14 PM +0200 4/21/09, David Négrier wrote:
>>Here is a quick explanation of what is going on behind the scene:
> Thanks -- I think I know what's going on. I've
> done sufficient ajax to know what's going on.
> However, what I don't understand is:
> 1. Detecting who is currently online (i.e., all
> who are connected to THE server);
> 2. And then how to send all of them stuff.
> For example, if you have four people connected to
> the server at the same time and one sends
> something, then how do you forward that to each
> person so that their screen refreshes accordingly?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php