jimsynz / faye-rails

Simple Rails glue for the Faye messaging protocol.
MIT License
435 stars 79 forks source link

Passenger support is broken #58

Closed stas-sl closed 9 years ago

stas-sl commented 10 years ago

It seems that this condition was deleted during merge (0773e007ed56fa43da3164885ddd9f4e8b78a3f5) from middleware.rb:

Faye::WebSocket.load_adapter(server) if server && server != 'passenger'

So it tries to load passenger adapter, but it doesn't exist.

abegosum commented 10 years ago

Seconded. I'm also seeing this issue.

Edit (more information): The problem seems to be in the faye-websockt gem, in websocket.rb. When the load_adapter method is called with passenger, there is not a constant (specified by an array on line 24 of websocket) matching passenger.

From line 24 of websocket.rb: ADAPTERS = { 'goliath' => :Goliath, 'rainbows' => :Rainbows, 'thin' => :Thin }

Considering there isn't a constant, line 42 attempts to require it outright. This leads to a "cannot load such file -- passenger" error, whether passenger is in your gemfile or not. load_adapter function in websocket.rb (the problem line is the first require): def self.load_adapter(backend) const = Kernel.const_get(ADAPTERS[backend]) rescue nil require(backend) unless const path = File.expand_path("../adapters/#{backend}.rb", FILE) require(path) if File.file?(path) end

dy1901 commented 10 years ago

I'm stuck on this problem too when I tried to use faye-rails and passenger together. Dose someone has clue to work around this?

  rake aborted!
       LoadError: cannot load such file -- passenger
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/faye-websocket-0.7.4/lib/faye/websocket.rb:42:in `load_adapter'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/faye-rails-2.0.0/lib/faye-rails/middleware.rb:44:in `initialize'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/stack.rb:43:in `new'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/stack.rb:43:in `build'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/stack.rb:118:in `block in build'
       /home/ubuntu/app/customer_feedback/tmp/build-14079498616826/vendor/bundle/ruby/2.1.0/gems/actionpack-4.0.3/lib/action_dispatch/middleware/stack.rb:118:in `each'
pierrea commented 10 years ago

:+1: Same here. How did you figure it out?

jimsynz commented 9 years ago

So this PR actually fixes this issue? It's hard to follow along :)

dduft commented 9 years ago

Will there be a new version for this?

jimsynz commented 9 years ago

Can someone confirm that it actually works first?

varun-raj commented 9 years ago

Any update ?

deepsystm commented 9 years ago

any news?

deepsystm commented 9 years ago

it solves by using latest version of gem

gem 'faye-rails', github: 'jamesotron/faye-rails'
jimsynz commented 9 years ago

Awesome. I'll bump and release.