Reputation: 2404
I've set up my Faye server, running alongside my rails server, like this tutorial tells me to: http://net.tutsplus.com/tutorials/ruby/how-to-use-faye-as-a-real-time-push-server-in-rails/
No strange behavior, until I uncomment that line
var client = new Faye.Client('http://localhost:9292/faye');
Firebug then gives me the error in the title of this question. Visiting localhost:9292/faye and /faye.js gives me what I'd expect, and (apparently) there isn't any problem with the javascript_include_tag that references that .js file.
I have to use bundle exec, per this error message when I start faye:
$ rackup ./config.ru -E production -s thin -p 9292
/Users/newcreation/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in ``block in setup': You have already activated rack 1.4.1, but your Gemfile requires rack 1.3.0. Using bundle exec may solve this. (Gem::LoadError)
My config.ru looks like this:
require 'rubygems'
require 'bundler'
Bundler.require
require 'faye'
require File.expand_path('../config/initializers/faye_token.rb', __FILE__)
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
run faye_server
Any ideas?
Thanks
Upvotes: 1
Views: 2813
Reputation: 2404
Apparently, you need at least version 0.7 to support websockets. http://blog.jcoglan.com/2011/11/28/announcing-faye-websocket-a-standards-compliant-websocket-library/ This meant updating rubygems, for me, and re-running bundle install. I also needed to change my .ru file to include the following:
Faye::WebSocket.load_adapter('thin')
Upvotes: 6