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

Add Action Cable to rails/master #22585

Closed
wants to merge 452 commits into from
Closed

Add Action Cable to rails/master #22585

wants to merge 452 commits into from

Conversation

dhh
Copy link
Member

@dhh dhh commented Dec 14, 2015

It Is Time.

dhh added 30 commits July 7, 2015 19:03
@lifo I couldn’t find any use of documentation for this, so removed it
for now. Was it just for testing?
We have the remote connections to immediately cut a connection when
someone has been kicked off. Let’s lean on that for now.
rafaelfranca and others added 19 commits December 3, 2015 13:02
Update README find_verified_user example
…to_readme

README.md instructions for configuring allowed request origins
Handle cases where logger is not a tagged logger.
Fix an error when using multiple gid identifiers
…mode

Add logging to stdout in development mode.
Allow regexp for a allowed_request_origins array
add devise example to readme
Freshen up the client-side subscription examples. Fixes #118
@@ -361,6 +390,7 @@ DEPENDENCIES
rails!
rake (>= 10.3)
redcarpet (~> 3.2.3)
redis (~> 3.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we never solved this problem, what do you think about having actioncable be in the default Gemfile instead? We probably shouldn't have the rails gem have a hard dependency on redis

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make redis "optional" in the same way that mysql or postgresql is optional for activerecord. So a run-time requirement. But Action Cable ships with Rails by standard, not in the Gemfile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that'll work here, since we conditionally require the adapter based on the configuration, but Action Cable will always end up being required. I'm concerned that this will cause a large number of existing apps to be unable to upgrade by default, if Redis isn't already installed on the machine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the redis requirement can just kick in when we start the server
with ./bin/cable or whatever. And then the redis gem file can be listed by
default in the default Gemfile for new apps. And if someone tries to start
bin/cable without that, we'll complain about why.

On Mon, Dec 14, 2015 at 4:57 PM, Sean Griffin notifications@github.com
wrote:

In Gemfile.lock
#22585 (comment):

@@ -361,6 +390,7 @@ DEPENDENCIES
rails!
rake (>= 10.3)
redcarpet (~> 3.2.3)

  • redis (~> 3.0)

I'm not sure that'll work here, since we conditionally require the adapter
based on the configuration, but Action Cable will always end up being
required. I'm concerned that this will cause a large number of existing
apps to be unable to upgrade by default, if Redis isn't already installed
on the machine.


Reply to this email directly or view it on GitHub
https://github.com/rails/rails/pull/22585/files#r47514517.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhh I think this would work. Will this have any after effects when someone is trying to upgrade from 4.2.x to 5?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I think whatever strategy we apply for redis should also be used for eventmachine as it's pretty heavyweight as well. We should see if we can drop the dependency on coffee-rails as well, as that's not something that rails currently has a dependency.

@nynhex
Copy link

nynhex commented Dec 14, 2015

Massive and amazing!

like Unicorn, but the latter must be multi-threaded, like Puma.


## Alpha disclaimer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhh Some sections of this README need to be revised for ActionCable to become part of Rails (such as this Alpha disclaimer).

Would you like me to open a PR against your branch with the suggested changes?
Should I also truncate the lines of the README following Rails conventions?

@rafaelfranca
Copy link
Member

We need a railtie for action cable. We need to change rails/all to load this new railtie. We will also need a skip_actioncable option and to update the application.rb to take in consideration that.

All these missing things will address the @sgrif comment about redis being required.

@@ -64,6 +64,17 @@ group :job do
gem 'sequel', require: false
end

# Action Cable
group :cable do
gem 'faye-websocket', '~> 0.10.0', require: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove all these dependencies but puma from here. They are all in the gemspec.

@dhh
Copy link
Member Author

dhh commented Dec 14, 2015

Closed in favor of #22586.

@dhh dhh closed this Dec 14, 2015
config.action_cable = ActiveSupport::OrderedOptions.new

config.to_prepare do
ApplicationController.helper ActionCable::Helpers::ActionCableHelper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include in ActionView::Base?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes more sense. Should be available everywhere.

On Mon, Dec 14, 2015 at 5:24 PM, Rafael França notifications@github.com
wrote:

In actioncable/lib/action_cable/engine.rb
#22585 (comment):

@@ -0,0 +1,27 @@
+require 'rails/engine'
+require 'active_support/ordered_options'
+require 'action_cable/helpers/action_cable_helper'
+
+module ActionCable

  • class Engine < ::Rails::Engine
  • config.action_cable = ActiveSupport::OrderedOptions.new
  • config.to_prepare do
  •  ApplicationController.helper ActionCable::Helpers::ActionCableHelper
    

Should we include in ActionView::Base?


Reply to this email directly or view it on GitHub
https://github.com/rails/rails/pull/22585/files#r47518344.

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

Successfully merging this pull request may close these issues.

None yet