Web Sockets, Comet, etc

software development


What are the preferred methods for hosting a sockets server of some kind on DH? I’m writing an app which will require a number of small groups of users (2-5 in a group typically) to frequently (perhaps 10 bursts of 2-3 messages each minute) exchange short messages (40-300 characters, probably JSON) with a hoped-for latency of several seconds at the most. Think Google Wave, but smaller ;-).

I’m coding the front-end using JQuery, but can use any method(s) which will allow support of most common browsers (I currently support FF3+, Chrome, Safari, IE7+). The less I have to write myself the better, but I’m not willing to adopt a major new JS framework.

On the back-end I’m using Sinatra, a Rails-like micro-framework that runs using the Passenger (mod_rails) plugin in Apache. Clearly that won’t suffice for my websockets needs, so I need a stand-alone server that can allocate a port on which to listen, notify the port number to Sinatra which will tell the clients know where to connect, and CC all messages as HTTP requests to Sinatra so the web-app can stay in sync with the socket server. If need be, I can even resort to coding such a server in C++, but if there is any existing DreamHost support for this kind of thing, I’m keen to hear about it.