11

I am building a real time chat into a rails 4 application. It seems ActionCable is the tool for this kind of job.

Is it possible to use ActionCable in rails 4 or do I have update to rails 5?

I cannot find any introduction for ActionCable with rails 4.

DenicioCode
  • 8,668
  • 4
  • 18
  • 33

2 Answers2

10

ActionCable is just a rails-5 way to handle websockets. For current rails there is Faye(https://github.com/faye) with multiple wrappers like private-pub and faye-rails.

Also you do not have to write the websocket handler in ruby at all

Vasfed
  • 18,013
  • 10
  • 47
  • 53
8

Rails, in and of itself, is just a collection of various Rubygems. ActionCable is just a new gem added to the collection with Rails 5. You can install ActionCable by itself via your Gemfile:

gem 'actioncable', '~> 5.0.0.beta3'

Then just go about setting it up. Here is a decent write up on it:

http://www.thegreatcodeadventure.com/rails-5-preview-action-cable/

wintersolutions
  • 5,173
  • 5
  • 30
  • 51
tagCincy
  • 1,589
  • 10
  • 20
  • 16
    Worth noting that trying to install actioncable 5.0.0.1 on Rails 4 is not possible, as it depends on actionpack 5.0.0.1, which seems to depend on Rails 5. – steel Oct 12 '16 at 19:51