[Mongrel] Comet style requests with mongrel

Jeremy Wilkins jeremy at ibexinternet.co.uk
Mon Nov 26 04:30:29 EST 2007

Cheers for the reply, the intention was to use a custom handler to  
bypass rails for just this one action. I'm currently using a poll,  
and am looking into the possibility of keeping the connection open  
instead. There will only be a maximum of 15 connections open at any  
one time - would this still be limited by ruby file descriptor limit?

I've managed to get mongrel handler almost doing what I want but not  
quite - I can't tell mongrel to flush data down the socket at the  
moment, is there a way to go about this. I've had a look at


but can't get this approach to work since it seems to depend on a non  
existant HTTPResponse.flush method.



On 23 Nov 2007, at 22:23, Zed A. Shaw wrote:

> On Fri, 23 Nov 2007 16:26:04 +0000
> Jeremy Wilkins <jeremy at ibexinternet.co.uk> wrote:
>> Hi,
>> I've been doing some experiments with php and if can use something  
>> like
>> <?php
>> for ($i = 0; $i < 100; $i++) {
>> 	echo "hello world";
>> 	flush();
>> 	sleep(10);
>> }
>> ?>
>> to keep a http link open for an arbitrary amount of time and
>> routinely display "hello world" in the browser window.
>> Is is possible to write a mongrel handler to do something similar?
> Yep, you could probably write a handler to do that, but probably  
> not a rails action without tons of surgery.
> However, this will fall down pretty quick once you hit Ruby's 1024  
> (or less) file descriptor limit due to its use of select.
> Zed
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list