Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Evented Fiber-aware Ruby webserver
Ruby
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.
bin
examples
lib
spec
.gitignore
.rspec
.yardopts
Gemfile
LICENSE
README.md
Rakefile
rity.gemspec

README.md

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 config.ru --bind 127.0.0.1 --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.

Introduction

Building a server

Building a client

Proxying data

Streaming

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 https://github.com/lgierth/rity

Install development dependencies

bundle install

Run the specs

bundle exec rake spec

Start a rackup server

bundle exec rity -r examples/simple_server.ru

Preview API documentation

bundle exec yard server

Contributing

  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.

Links

License

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

Something went wrong with that request. Please try again.