April 20 - posted a fix to chapter 9:
- Make sure you have all the prerequisites installed:
Rails 2.0.2 or edge
Json gem (gem install json)
EventMachine gem (gem install eventmachine) - Install the GEM -
sudo gem install juggernaut
- Create a new Rails APP -
rails koko
- Enter it's dir -
cd koko
- Install the Juggernaut plugin -
ruby script/plugin install
http://juggernaut.rubyforge.org/svn/trunk/juggernaut - Paste this inside koko/juggernaut.yml -
http://pastie.caboo.se/179083 - Paste this inside koko/config/juggernaut_hosts.yml -
http://pastie.caboo.se/179077 - Paste this inside koko/app/controllers/chat_controller.rb -
http://pastie.caboo.se/179079 - Paste this inside koko/app/views/chat/index.rhtml -
http://pastie.caboo.se/179073 - *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 - Run the Juggernaut Server -
juggernaut -c juggernaut.yml
"Starting Juggernaut server on port: 5001..." is the answer you than expect - Run the Rails Server -
script/server
- 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!
Resources:
http://juggernaut.rubyforge.org/
http://groups.google.com/group/Juggernaut-for-Rails







