Re: Re: about php comet

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

 



On Fri, Jun 3, 2011 at 3:43 AM, æç|åäæ <calidion@xxxxxxxxx> wrote:

>
>
> 2011/6/3 Adam Richardson <simpleshot@xxxxxxxxx>
>
>> On Fri, Jun 3, 2011 at 2:20 AM, æç|åäæ <calidion@xxxxxxxxx> wrote:
>>
>>> is there an efficient way to hold the requests while loop is an expensive
>>> way in most cases.
>>
>>
>> You can call sleep(number_of_seconds_to_sleep) within the while loop to
>> lower the cost, so to speak.
>>
> yes, an interrupt will be a better way. currently libevent is in beta
> state, and i don't know if the libevent extension can be used in mod_php to
> implement comet applications.
>

Oh, I see. Yes, I'm not sure I'd try using that extension yet.


>
>>
>>> and i don't know how to notify the holding connections if the change need
>>> to be notify to the holding requests?
>>>
>>
>> Sorry, I'm not sure what you mean here.
>>
>
> please forgive my poor english, i mean we may have projects need
> interaction with mulitple users and the state changes of one user should be
> send to the users involved, like online games chatting rooms.
>

I believe I understand you, now. This could get costly in terms of
resources, and I now better understand your interest in the libevent
extension.

I'd be tempted to write custom C extensions for a web server like nginx,
which naturally handles asynchronous IO. And, in this case, you could even
make use of fast polling instead of long polling, due to the performance of
nginx, such as demonstrated in the this example:
http://amix.dk/blog/post/19414

And, don't worry about your English too much. My Chinese stops after ni hao
;)

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