Navigation Menu

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 ActionCable channel/connection load hooks #35094

Merged
merged 1 commit into from Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions actioncable/CHANGELOG.md
@@ -1,3 +1,16 @@
* Add `:action_cable_connection` and `:action_cable_channel` load hooks.

You can use them to extend `ActionCable::Connection::Base` and `ActionCable::Channel::Base`
functionality:

```ruby
ActiveSupport.on_load(:action_cable_channel) do
# do something in the context of ActionCable::Channel::Base
end
```

*Vladimir Dementyev*

* Add `Channel::Base#broadcast_to`.

You can now call `broadcast_to` within a channel action, which equals to
Expand Down
2 changes: 2 additions & 0 deletions actioncable/lib/action_cable/channel/base.rb
Expand Up @@ -307,3 +307,5 @@ def transmit_subscription_rejection
end
end
end

ActiveSupport.run_load_hooks(:action_cable_channel, ActionCable::Channel::Base)
2 changes: 2 additions & 0 deletions actioncable/lib/action_cable/connection/base.rb
Expand Up @@ -260,3 +260,5 @@ def successful_request_message
end
end
end

ActiveSupport.run_load_hooks(:action_cable_connection, ActionCable::Connection::Base)
2 changes: 2 additions & 0 deletions guides/source/engines.md
Expand Up @@ -1497,6 +1497,8 @@ To hook into the initialization process of one of the following classes use the
| Class | Available Hooks |
| --------------------------------- | ------------------------------------ |
| `ActionCable` | `action_cable` |
| `ActionCable::Channel::Base` | `action_cable_channel` |
| `ActionCable::Connection::Base` | `action_cable_connection` |
| `ActionController::API` | `action_controller_api` |
| `ActionController::API` | `action_controller` |
| `ActionController::Base` | `action_controller_base` |
Expand Down