Friday, April 11, 2008

Juggernaut, an up-to-date tutorial

April 20 - posted a fix to chapter 9:

  1. Make sure you have all the prerequisites installed:

    Rails 2.0.2 or edge
    Json gem (gem install json)
    EventMachine gem (gem install eventmachine)

  2. Install the GEM -
    sudo gem install juggernaut
  3. Create a new Rails APP -
    rails koko
  4. Enter it's dir -
    cd koko
  5. Install the Juggernaut plugin -
    ruby script/plugin install
    http://juggernaut.rubyforge.org/svn/trunk/juggernaut
  6. Paste this inside koko/juggernaut.yml -

    http://pastie.caboo.se/179083



  7. Paste this inside koko/config/juggernaut_hosts.yml -

    http://pastie.caboo.se/179077



  8. Paste this inside koko/app/controllers/chat_controller.rb -

    http://pastie.caboo.se/179079



  9. Paste this inside koko/app/views/chat/index.rhtml -

    http://pastie.caboo.se/179073



  10. *FOR UBUNTU ONLY (and maybe other linux distors too):
    export PATH=$PATH:/var/lib/gems/1.8/bin
    (add it to your bash.profile too)
    or use /var/lib/gems/1.8/bin/juggernaut in the next phase

  11. Run the Juggernaut Server -
    juggernaut -c juggernaut.yml

    "Starting Juggernaut server on port: 5001..." is the answer you than expect
  12. Run the Rails Server -
    script/server
  13. Browse to -

    http://localhost:3002/chat?send_to_channel=1&listen_to_channel=1


    You will be sending and receiving through the channel numbers specified in the QueryString

    You can use either "RAILS SEND" to send through the Rails Server or "JS SEND" to use the Ruby Server only ( YES - it will work with your Rails server down)

    Notice that I've "faked" a firebug-like console on the right, to see all Juggernaut logs in realtime even if you're not using firebug.

    The input from the listened-to channel is shown on the left box.

    Now, open another browser with the same URI and start chatting!



ENJOY!



Resources:
http://juggernaut.rubyforge.org/
http://groups.google.com/group/Juggernaut-for-Rails

Juggernaut, Push Server, The future of the web

My dear blog, it's been 3 long month since my last post. Forgive me.
I had so many stuff to do:

But than - suddenly, unexpectedly, I ran across... The next hottest thing in WEB - JUGGERNAUT!


Yes, treat it as the new Gospel in our business... web.
  1. What is it?
  2. What's new? we had it since ever!
  3. How will it change the web?
  4. How can I start?
1. What is it?


It's more than Ajax.
Ajax is an HTTP connection that's opened especially per request and closes as it ends.
Juggernaut, with Flash OBJECT on the Client Side and Ruby Server (Push Server) on the Server Side, allows you to keep an open connection and thus allow real-time connection.



YU HU!!! what's so amazing about it?
??

Very high frequency (on my machine ~ 2000 req/second)
Scalability (based on EventMachine)
Low Hosting Costs (less servers and memory is needed than if Ajax was used)

2. What's new? we had it since ever!

Juggernaut does it well, easy, cheap and smart.

Client Side: JavaScript + Flash Object
Server Side: Ruby

3. How will it change the web?

Chat is nice but think of all the collaboration and real-time data services you know, think of it functioning 10x faster.

4. How can I start?

Luckily, Juggernaut code is updated very frequently - improvements are made and bugs are being treated.

Unfortunately, it changed it's already somewhat known API and so the already written tutorials are obsolete.

Luckily, I am going to explain how to get this sweety to work in my next post:

http://www.dorkalev.com/2008/04/juggernaut-up-to-date-tutorial-1042008.html

Kudos to Alex MacCaw from http://www.eribium.org/ for creating and maintaining Juggernaut