[Mongrel] Comet style requests with mongrel

Zed A. Shaw zedshaw at zedshaw.com
Fri Nov 23 17:23:23 EST 2007


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


More information about the Mongrel-users mailing list