Re: Chat with php

From: Date: Mon, 07 Oct 2002 18:34:47 +0000
Subject: Re: Chat with php
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-119125@lists.php.net to get a copy of this message
It sure does. I didn't say it was perfect :) But at least it doesn't constantly reload, which is fine if you have a limitted number of poeple entering the room. Otherwise the invis pixel things sounds a lot superior, even though you sit there polling the machine. For 1x1 pixels :) Cheers, Rob. ------------------------------------------------------------------------ Marco Tabini wrote: > > But, Robert, doesn't this technique leave a connection open on the > server--and, won't it cause the server to run out of resources after a > very finite number of connections has been established? > > Marco > > On Mon, 2002-10-07 at 14:07, Robert Cummings wrote: > > 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 | `----------------------------------------------'

« previous php.general (#119125) next »