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







10 comments:
Newbie Alert!
Whats about the 'Juggernaut error. 'swf_name' must be unique per juggernaut instance.' -Error ?
Ups! I mean:
Thanks for the quick tutorial.
I´m a newbie and get the swf_name error.
Do anyone know anything about it?
Thanks!
Having the same problem,
'Juggernaut error. 'swf_name' must be unique per juggernaut instance.'
it shouldn't avoid you from working, though
go directly to http://localhost:3002/chat
(no parameters)
look at the console on the right,
it should show:
Juggernaut: Connected on 127.0.0.1:5001
look at the console on the left,
write something in the input box and click one of the buttons
it should be shown there
It works :)
thx
eventmachine tutorial
i really wanted to find an "eventmachine tutorial" so I googled for it and saw this post as the #1 result.
It was pretty frustrating, as there is no doubt it won't help me.
"Life is not without a sense of Irony." Morpheus, Matrix
Dor,
I tried your tutorial on a Ubuntu 7.10 server, with Rails 2.02.
All I get is a blank page. The swf object appears to be there, and the javascript, but no data at all. No errors in firebug until I hit a button.
any ideas?
John Fisher
dear john,
have you used the URL:
http://localhost:3002/chat?send_to_channel=1&listen_to_channel=1
?
Thanks Dor,
I tried your suggestion and still nothing... In my case its a separate server and mongrel just-happens-to-be running on port 3000 so I used
http://ip.ip.ip.ip:3000/chat?send_to_channel=1&listen_to_channel=1
Let me be clear: the text and javascript elements are coming through but the boxes are empty as are the channel numbers. I tried deleting the cookie too as suggested elsewhere.
Any other ideas?
John
Great job, dor kalev!
just one little question, I set it up on windows with instantRails. Everything seems to be ok except I can't chat in channels, I can send and receive messages in http://localhost:3000/chat with no parameters, but it doesn't want to work in channels, I'll simply got nothing after I hit either send button. There's nothing in the right window, it just says: Juggernaut: Connected on 127.0.0.1:5001.
Also, juggernaut wouldn't work if I refresh the page as well.
Does anyone know about this? Thanks.
-Terrance
Post a Comment