Re: Re: about php comet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux