Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Evented Fiber-aware Ruby webserver
Branch: docs

This branch is 3 commits ahead of master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Evented HTTP toolkit for Ruby

Rity provides a rich toolkit for building custom services that communicate via HTTP. It can be used to build clients as well as servers, proxies and streaming APIs. Rity uses EventMachine's native proxying to let data completely bypass Ruby if possible, saving CPU time and increasing IO throughput.

Getting started

gem install rity

The easiest way to get up and running with Rity is to serve your Rack app with it. Rity uses EventMachine to do evented networking and processing, thus doing any kind of IO or long-running computations in a blocking manner is uncool. Rity uses EM-Synchrony and Ruby 1.9's Fibers to cooperatively schedule the processing work against the event loop (similar to Goliath). If you're not yet familiar with the combination of EventMachine and Fibers, you should give Ilya Grigorik's introduction a read.

The following line represents the options of Rity's CLI and their defaults.

rity --rackup --bind --port 3000

You can use the --quiet and --verbose options to suppress output or get detailed debugging output, respectively. Shortcuts and more documentation of the CLI can be found by typing rity help.


Building a server

Building a client

Proxying data


To do list

  • Proxying via EM.enable_proxy
  • Contents of env hash
  • Headers with multiple values
  • Implement Rack spec
  • Rack Handler
  • Support for keep-alive connections
  • Investigate MVM support in JRuby/Rubinius/MRI
  • Support for SPDY
  • Investigate preforking and letting multiple EventMachine loops listen on a shared socket
  • Support for X-Sendfile header
  • Deamonizing & dropping privileges

Hacking on Rity

Get the source code

git clone

Install development dependencies

bundle install

Run the specs

bundle exec rake spec

Start a rackup server

bundle exec rity -r examples/

Preview API documentation

bundle exec yard server


  1. Fork the project.
  2. Make your feature addition or bug fix.
  3. Add tests for it. This is important so I don't break it in a future version unintentionally.
  4. Send me a pull request. Bonus points for topic branches.



Rity is released under the terms of the MIT License, see the included LICENSE file.

Something went wrong with that request. Please try again.