Today we will start creating our own Rails flash socket based chat engine.

What is Juggernaut?

The Juggernaut plugin for Ruby on Rails aims to revolutionize your Rails app by letting the server initiate a connection and push data to the client. In other words your app can have a real time connection to the server with the advantage of instant updates. Although the obvious use of this is for chat, the most exciting prospect is collaborative cms and wikis. Now you won't need to make requests every 1-2 seconds to check for data. Data will be send directly to you!

Lets assume - we have 60 chat users. Each one checks every 0.5 second for new data. They don't write anything - just sit there, but there will always be 120 requests per second even when nothing is happening. And that's the place where Juggernaut magic helps

Installation

This tutorial is for *nix users - never tried to run it on Windows.

What we need?

We need to install some additional gems:

gem install json
gem install eventmachine

And of course Juggernaut:

sudo gem install juggernaut

And that’s all for now. Next time we will start building our small chat.

Tutorial parts:

  1. Juggernaut Rails Chat – part I (what is and how to install Juggernaut)
  2. Juggernaut Rails Chat – part II (design)
  3. Juggernaut Rails Chat – part III (registration and authentication)
  4. Juggernaut Rails Chat – część IV (zarządzanie pokojami)
  5. Juggernaut Rails Chat – część V (łączenie użytkowników z pokojami)
  6. Juggernaut Rails Chat – część VI (odpalamy Juggernaut i nasz chat)
  7. Juggernaut Rails Chat – część VII (emotikonki i dźwięk)