diff options
author | Matthew Draper <matthew@trebex.net> | 2016-07-04 08:44:14 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-04 08:44:14 +0930 |
commit | 08a907461341486e371774dd69c43852657c0f4f (patch) | |
tree | 201c34191879ad92a8f39901ba10aa6e4fd80dbe /actioncable/lib/action_cable/server | |
parent | 550303c05c48f17b699a13258608e04bf63cf0e8 (diff) | |
parent | f3ba0c1dd32821ad700b2784d160d1c161fb3125 (diff) | |
download | rails-08a907461341486e371774dd69c43852657c0f4f.tar.gz rails-08a907461341486e371774dd69c43852657c0f4f.tar.bz2 rails-08a907461341486e371774dd69c43852657c0f4f.zip |
Merge pull request #24988 from mwear/action_cable_broadcast_notifications
Add ActiveSupport::Notifications hook to ActionCable::Server.broadcast
Diffstat (limited to 'actioncable/lib/action_cable/server')
-rw-r--r-- | actioncable/lib/action_cable/server/broadcasting.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actioncable/lib/action_cable/server/broadcasting.rb b/actioncable/lib/action_cable/server/broadcasting.rb index 8f93564113..1fc58baa3e 100644 --- a/actioncable/lib/action_cable/server/broadcasting.rb +++ b/actioncable/lib/action_cable/server/broadcasting.rb @@ -39,8 +39,12 @@ module ActionCable def broadcast(message) server.logger.info "[ActionCable] Broadcasting to #{broadcasting}: #{message.inspect}" - encoded = coder ? coder.encode(message) : message - server.pubsub.broadcast broadcasting, encoded + + payload = { broadcasting: broadcasting, message: message, coder: coder } + ActiveSupport::Notifications.instrument("broadcast.action_cable", payload) do + encoded = coder ? coder.encode(message) : message + server.pubsub.broadcast broadcasting, encoded + end end end end |