is there an efficient way to hold the requests while loop is an expensive way in most cases. and i don't know how to notify the holding connections if the change need to be notify to the holding requests? writing extension to php is also a very expensive way for me:( 2011/6/3 Adam Richardson <simpleshot@xxxxxxxxx> > On Fri, Jun 3, 2011 at 1:50 AM, æç|åäæ <calidion@xxxxxxxxx> wrote: > >> any idea? >> >> 2011/5/25 æç|åäæ <calidion@xxxxxxxxx> >> >> > hello, >> > >> > I am every interested in comet applications recently, and sadly found >> php >> > is very weak in this area. >> > >> > i am just wondering if it is possible to write an extension to extend >> the >> > ability of the php to easy the way to comet applications? >> > >> > if it possible for php to hold the connect from the client when it is in >> > fast cgi mode or apache mod php mode? >> > > Comet can use one of several techniques for low-latency data ( > http://cometdaily.com/about/), with the long-polling mechanism to simulate > the realtime pushing of data from the server being a popular option: > http://cometdaily.com/2007/11/15/the-long-polling-technique/ > http://en.wikipedia.org/wiki/Comet_(programming) > > <http://en.wikipedia.org/wiki/Comet_(programming)>To my understanding, PHP > itself can accommodate this quite nicely. Merely start an infinite loop that > breaks and returns new data when available. You'll probably have to adjust > your web server settings and php.ini configuration to allow reasonably long > requests for this particular need. However, when requests do time out, it's > not a big deal as the javascript should be set up to reinitiate a new > request if that happens, just as it would if the request returned new data > and closed, giving the appearance of a continuous stream of pushed data. > > This all said, if you wanted to write an extension to facilitate long > polling, you could, but given the natural latencies for these requests, I'm > not sure you'd find a significant benefit. > > Adam > > -- > Nephtali: A simple, flexible, fast, and security-focused PHP framework > http://nephtaliproject.com >