[Mongrel] mongrel and comet "implementation"

Topher Cyll christophercyll at gmail.com
Thu Aug 10 02:45:00 EDT 2006


Hey folks,

I was playing around with adding Comet (a javascript technology used
to receive events without AJAX polling) support to Mongrel. More info
about Comet here:

http://en.wikipedia.org/wiki/Comet_%28programming%29)

I sort of got it working. My code is available at:

http;//cyll.org/comet.tar.gz

Run comet.rb from inside the directory and point your browser at:
http://localhost:5555/

The fly in the ointment is that until a Comet request finishes, that
URL mount point stops responding. I assume this is because of how
thread management happens in Mongrel. Leaving the request unfinished
like I do is probably uncool.

One way to sort of work around the problem is to use a dispatcher that
registers a new handler at a unique URL for each Comet user. You can
see that both the main page and:

http://localhost:5555/2

work simultaneous. And neither affects other mounted handlers, so you
can also access:

http://localhost:5555/moose

Anyways, I'm not really doing anything with this code and I'm sure it
has problems, but I thought I'd put it out there in case anyone else
wanted to play around with Mongrel and Comet.

Mongrel rocks,
Topher Cyll


More information about the Mongrel-users mailing list