On Fri, Jun 3, 2011 at 1:50 AM, 李白|字一日 <calid...@gmail.com> wrote:

> any idea?
> 2011/5/25 李白|字一日 <calid...@gmail.com>
> > 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://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.


Nephtali:  A simple, flexible, fast, and security-focused PHP framework

Reply via email to