RE: [PHP] Chat with php
| From: | Brad Dameron | Date: | Mon, 07 Oct 2002 18:25:00 +0000 |
| Subject: | RE: [PHP] Chat with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119117@lists.php.net to get a copy of this message | ||
Another way is to use javascript with PHP to pull the database every so many
seconds. I have seen this in I think it was PHPChat. Been a long time
however.
---
Brad Dameron Network Account Executive
TSCNet Inc. www.tscnet.com
Silverdale, WA. 1-888-8TSCNET
> -----Original Message-----
> From: robert.cummings@webmotion.com
> [mailto:robert.cummings@webmotion.com]
> Sent: Monday, October 07, 2002 11:07 AM
> To: Oliver Witt
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Chat with php
>
>
> 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.
>
> Oliver Witt wrote:
> >
> > I attempted to write a oage that you can chat on with php. It ended up
> > being a page that reloads itself all the time which isn't really what I
> > wanted. But I didn't know how to do it differently. Is there another
> > way? I heard something about flush()?
> > Kind regards,
>
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer |
> :----------------------------------------------:
> | Mail : mailto:robert.cummings@webmotion.com |
> | Phone : (613) 731-4046 x.109 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com |
> | Fax : (613) 260-9545 |
> `----------------------------------------------'
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>