I am following this tutorial to the letter :
http://net.tutsplus.com/tutorials/ruby/how-to-use-faye-as-a-real-time-push-server-in-rails/
I have installed thin, faye and written the following in the faye.ru file :
require 'faye'
bayeux = Faye::RackAdapter.new(:mount => '/faye', :timeout => 25)
bayeux.listen(9292)
But when I start the rack up server :
rackup faye.ru -E production -s thin
The server does start correctly :
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:9292, CTRL+C to stop
But when I access any webpage, such as "http://localhost:9292/", I get the following message :
Sure you're not looking for /faye ?
And the neither this tutorial nor Ryan Bates rails cast #260 give an explanation of why this is happening. Does somebody have an idea?
I must say that my project is using ruby version 1.8.7 (and I can't upgrade to 1.9 because some of the gems I use do not support 1.9 yet).
Ok, actually everything works fine, I was just not understanding what Faye was supposed to do.
The Faye server does not replace the Rails server but rather complements it. I was expecting to see the same thing on localhost:3000 and localhost:9292.
In case somebody else is confused like I was, you have to run both servers at the same time:
Rails server :
rails server [with your options if any]
Faye server to handle JS channels :
rackup faye.ru -s thin -E production
And the users interact with the rails server only (on port 3000) and leave the Faye server run in the background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With