How about Faye? It's an implementation of the Bayeux protocol in JavaScript and Ruby, with both server and client code available in both languages. There's a JS client for browsers too:
http://svn.cometd.com/trunk/bayeux/bayeux.html
http://faye.jcoglan.com/
http://github.com/jcoglan/faye