Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news. Node.js-style Event Driven Awesomeness for Rubyists

By Peter Cooper / December 15, 2010

cooldude.pngBeen missing esteemed rapper and author Coolio (real name Tony Arcieri) recently? He's been busy studying Ruby and building (or GitHub repo), a Node.js and Sinatra inspired "event framework" for Ruby powered by libev. Think EventMachine but with a cuter, Sinatra-style API. isn't exactly new, though, it's a rewrite-meets-rebrand of Rev (which started life back in 2007). (formerly known as Rev, and pronounced like Coolio of Gangster's Paradise fame) is an event framework for Ruby built on libev, the same library that provides high performance asynchronous I/O for Node.js. is great for building TCP clients and servers which handle large numbers of connections and are primarily I/O bound. also provides APIs for filesystem monitoring. is an alternative to EventMachine, albeit one which using Ruby's own native I/O primitives rather than reinventing them, and does as much as possible in Ruby instead of C, which should make it easier for interested contributors to hack on.

Tony Arcieri

You can install with gem install (it just feels weird to have a period in a gem name, no?) and be up and running quickly with's default example script:

require 'rubygems'
require ''

ADDR = ''
PORT = 4321 ADDR, PORT do
  on_connect do
    puts "#{remote_addr}:#{remote_port} connected"

  on_close do
    puts "#{remote_addr}:#{remote_port} disconnected"

  on_read do |data|
    write data

puts "Echo server listening on #{ADDR}:#{PORT}"

This program listens on localhost at port 4321, accepts connections, and echos data back to them. You could make it serve up Web pages (especially through Rainbows), have it share data between clients to make a chat system or.. whatever you like.

Unlike a non-event driven single threaded daemon, a powered daemon can take multiple connections and manage them simultaneously without needing to fork or create extra threads. In this respect it's similar to EventMachine although it doesn't use EventMachine at all (but cutely has an EventMachine emulator baked in) and is developed mostly in Ruby rather than C.

Want to know more?'s snazzy homepage is the place to start.


  1. Andy Blake says:

    Coolio? It's a joke, right?

  2. Guoliang Cao says:

    This is cool! We do not want cool to appear in every object's method list though ;-)

  3. Roland says:

    hey, they took my name!

  4. Paul H says:

    I'm having trouble installing this on Windows 7 / Ruby 1.9.2. I am also unable to install iobuffer. Has anyone had this issue?

    Both had the same behavior, failed to build gem native extension.

  5. Paul says:

    @Andy It obviously is. The Guy on the homepage is the rapper Coolio whos realname is Artis Leon Ivey, Jr. according to wikipedia. Tony Arcieri looks a bit different according to his github account.

  6. mario says:

    Is there an HTTP example anywhere? Would like to see how stacks up. node.js is blazing FAST and is about to get another speed boost from v8. I'm not tied to javascript, but the speed difference between Ruby and V8 Javascript is night and day.

  7. Nathan says:

    @mario node.js uses libev so should be the same as node.js

Other Posts to Enjoy

Twitter Mentions