Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with ActionCable #298

Closed
jakoss opened this issue Feb 25, 2016 · 6 comments
Closed

Compatibility with ActionCable #298

jakoss opened this issue Feb 25, 2016 · 6 comments

Comments

@jakoss
Copy link

jakoss commented Feb 25, 2016

ActionCable from rails 5 is not working on thin. Whole problem is investigated and described here rails/rails#23696 . My question is - is there possibility for Thin to enable rack hijack support?

@macournoyer
Copy link
Owner

It is possible, but I don't think it make sense to implement the Rack hijack API in Thin. The whole concept is based on blocking socket I/O and Thin uses non-blocking I/O.

So I would recommend you use another server if you need Rack hijack support.

The way to do it w/ Thin would be to use https://github.com/macournoyer/thin_async.

@macournoyer
Copy link
Owner

I just tested this out, and ActionCable does work w/ Thin!

w/ a few extra configs:

In your Gemfile:

gem 'faye-websocket'
gem 'thin'

Create a config/initializers/thin_action_cable.rb:

Rails.application.config.action_cable.use_faye = true
Faye::WebSocket.load_adapter 'thin'

@malonehedges
Copy link

@macournoyer My app is crashing when Rails.application.config.action_cable.use_faye = true is included but runs just fine with only Faye::WebSocket.load_adapter 'thin'. Is the first line required? I couldn't find any documentation on it anywhere but these GitHub issues.

@macournoyer
Copy link
Owner

@malonehedges what is the error message? Maybe you forgot to add the gem 'faye-websocket'

@malonehedges
Copy link

@macournoyer

=> Booting Thin
=> Rails 5.1.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/Users/malonehedges/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.1/lib/action_cable/engine.rb:37:in `block (3 levels) in <class:Engine>': undefined method `use_faye=' for #<ActionCable::Server::Configuration:0x007fe2bd4fa9a0> (NoMethodError)

@Llermy
Copy link

Llermy commented Sep 28, 2017

@macournoyer I actually have the same error as @malonehedges . In rails 5.0 everything works right, but in rails 5.1 I have the same error undefined method 'use_faye=' for #<ActionCable::Server::Configuration:0x007fe2bd4fa9a0> (NoMethodError)

I've checked ActionCable::Server::Configuration and the property #use_faye indeed doesn't exist any more for actioncable 5.1.
ActionCable::Server::Configuration 5.0
ActionCable::Server::Configuration 5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants