Re: Chat with php
| From: | Oliver Witt | Date: | Mon, 07 Oct 2002 18:19:52 +0000 |
| Subject: | Re: Chat with php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119116@lists.php.net to get a copy of this message | ||
Robert Cummings schrieb:
> You can have your script enter a loop to check for data in a database.
> If data output it then calls the flush() function to output to the browser.
> Then sleep for some time, then wakeup and repeat. You may have issues
> with some browsers using this technique, but generally it does work.
> The key is that you never close the connection to the browser. You'll
> also want to occasionally output some invisible content, otherwise the
> connection_status() stuff never give the right value (at least not in
> 4.1.2) It struck me that these functions update their flags on output
> only. Which means you need to output something to the browser to detect
> that the user has hit stop, or has disconnected.
>
> Cheers,
> Rob.
>
Thanks for the answer, but that was a little bit too complicated for me. I know
more about javascript. How do I do such a loop? Something similar like
set_interval in javascript? What invisible content do I have to output? And
what do I have to output to the browser to detect if the user's still active?
Olli