Mongrel Comet Update

If you've been looking to do Comet work using Ruby and Mongrel, I might have some good news.

I'd previously reported that my code to add Comet support to Mongrel required a seperate URL handler at a different mount point for each persistent connection because of some mysterious threading issue.

Looks like I may have been misunderstanding what was going on. In fact, Joseph McDonald reports that it works just fine... provided you remember to respect your browsers allowed number of connections. I'm not sure why I'd forgotten about this during testing. From Wikipedia:

Browsers pose a further limitation: section 8.1.4 of the HTTP 1.1 spec states that "A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy", and this recommendation is in fact followed by the most common browsers, including Internet Explorer and Firefox. Holding one connection open for HTTP streaming tends to create performance issues for AJAX applications, such as inability to kick off a new user-initiated data request while a series of images are being loaded. This is often worked around by creating a distinct hostname for push connections (even with a single physical server).

posted on: 12/10/2006 | path: /tech