Cramp is a fully asynchronous real-time web application framework in Ruby. It is built on top of EventMachine and primarily designed for working with larger number of open connections and providing full-duplex bi-directional communication.

Features

  • Lightweight, minimal and able to handle thousands of open connections simultaneously
  • Built in support for HTML5 technologies: WebSockets and Server-Sent Events ( EventSource )
  • Easy peasy Streaming APIs
  • Allows Ruby 1.9 + Fibers to prevent asynchronous callbacks spaghetti
  • Seamless Active Record integration
  • Rack Middlewares support + Rainbows! and Thin web servers

Getting Started

Ruby 1.9.2+ is the preferred version of Ruby for running Cramp. Installation process is quite straight forward:

$ gem install cramp

And here’s the obligatory “Hello World”:

# hello_world.ru
require "rubygems"
require 'cramp'

class HomeAction < Cramp::Action
  def start
    render "Hello World"
    finish
  end
end

# thin --timeout 0 -R hello_world.ru start
run HomeAction

Cramp ships with an application generator, which is great for getting off the ground.

$ cramp new realapp

You can find various other Cramp applications in the examples section. Please read through the documentation for finding out more about Cramp.

Contribute

Cramp is hosted on Github. Please use Github Issues for submitting bug reports and Pull Requests for submitting patches.

Getting Help

Please send all your questions to the Cramp mailing list. Feel free to tweet @lifo with any suggestions or feedback.