aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authorVladimir Dementyev <dementiev.vm@gmail.com>2019-01-29 22:07:49 -0500
committerVladimir Dementyev <dementiev.vm@gmail.com>2019-01-29 22:07:49 -0500
commit8ed276b2f785710420fc51cd1b8fccd89cb4a06e (patch)
tree8658c241b7e05fdae5d2da5c3469bc889b0a4953 /actioncable
parent94d54fa4ab641a0ddeb173409cb41cc5becc02a9 (diff)
downloadrails-8ed276b2f785710420fc51cd1b8fccd89cb4a06e.tar.gz
rails-8ed276b2f785710420fc51cd1b8fccd89cb4a06e.tar.bz2
rails-8ed276b2f785710420fc51cd1b8fccd89cb4a06e.zip
Add ActionCable channel/connection load hooks
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/CHANGELOG.md13
-rw-r--r--actioncable/lib/action_cable/channel/base.rb2
-rw-r--r--actioncable/lib/action_cable/connection/base.rb2
3 files changed, 17 insertions, 0 deletions
diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md
index f0a01dce47..42edbd6954 100644
--- a/actioncable/CHANGELOG.md
+++ b/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
diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb
index ad0d3685cd..af061c843a 100644
--- a/actioncable/lib/action_cable/channel/base.rb
+++ b/actioncable/lib/action_cable/channel/base.rb
@@ -307,3 +307,5 @@ module ActionCable
end
end
end
+
+ActiveSupport.run_load_hooks(:action_cable_channel, ActionCable::Channel::Base)
diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb
index 0044afad98..c469f7066c 100644
--- a/actioncable/lib/action_cable/connection/base.rb
+++ b/actioncable/lib/action_cable/connection/base.rb
@@ -260,3 +260,5 @@ module ActionCable
end
end
end
+
+ActiveSupport.run_load_hooks(:action_cable_connection, ActionCable::Connection::Base)