Simple example of Twitter + AMQP + RabbitMQ + EventMachine + HTML5 WebSocket with no polling
Latest commit 2ea3282 Aug 7, 2012 @rubenfonseca Merge pull request #2 from nel/master
Make it work with latest version of AMQP
Failed to load latest commit information.
.gitignore add Gemfile.lock & .rbenv in gitignore Aug 7, 2012
Gemfile added source description May 18, 2010
README.textile updated readme May 18, 2010
socket.rb Upgrade version of amqp and get rid of raceconditions Aug 7, 2012
twitterfeed.rb Upgrade version of amqp and get rid of raceconditions Aug 7, 2012


Twitter AMQP WebSocket Example

Quick experiment of going from twitter to the browser, with no polling.

It goes something like this:

Twitter Stream → Filter → RabbitMQ → AMQP → EventMachine → WebSocket → HTML5 Browser

Since it uses a fanout exchange on RabbitMQ, it allows to have multiple clients connected to the eventmachine loop and receive the same real-time updates (and hopeful it will scale).


  • Ruby
  • RabbitMQ
  • gem install bundler

How To

  1. bundle install (first time, to install the dependencies)
  2. rabbitmq-server # start rabbitmq
  3. ruby twitterfeed.rb twitter_username twitter_password # start the filter
  4. ruby socket.rb # on another shell

Then you can open client/index.html on a HTML5 WebSocket compatible browser (tested with Webkit nightly).

Read the code, and have fun! :)