I’m new to websockets so bear with me.
From what I can tell, running both your websocket and your normal http
traffic on port 80 is not only possible, but how websockets was (were?)
designed to work.
A lot of the example code out there seems to assume you’ll just run your
websocket off a separate port. I think that’s how diaspora works. But
this takes away all the magic port-80 goodness that we want to have when
using a websocket.
So what jruby-compatible ruby server can handle both types of traffic in
a single process?Sunshowers http://rainbows.rubyforge.org/sunshowers/,
which is unicorn-based, won’t run under jruby because the unicorn
dependency kgio gem is MRI-specific.Cramp
http://m.onkey.org/introducing-cramp has websocket support but needs
either Rainbows! (again, unicorn-based) or thin (not yet supported under
jruby).
That being said, I’ve gotten bothem-websockets
https://github.com/igrigorik/em-websocket andevented mongrel
http://swiftiply.swiftcore.org/mongrel.htmlrunning under jruby. I’m
thinking of combining the code (or at least the general ideas) from
these two sources to build something that handles both. That way I get
websocket goodness + rack support for normal http requests.
Note that I want to use a primarily ruby server, not one of the evented
java web servers out there. I have my reasons, but am willing to
entertain the idea that maybe that’s where I should be looking.
Thoughts? Thanks!
Mike