diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-20 16:22:40 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-20 16:22:40 +0200 |
commit | 294a277a8409e05c6b98cd8e46a8e0745f68b40d (patch) | |
tree | 093decd716e80cfc208f31dae55aa9935fe572fa /lib/action_cable/channel | |
parent | 404867d332069d8b87547e1eae5ed1d0a7a1b95c (diff) | |
download | rails-294a277a8409e05c6b98cd8e46a8e0745f68b40d.tar.gz rails-294a277a8409e05c6b98cd8e46a8e0745f68b40d.tar.bz2 rails-294a277a8409e05c6b98cd8e46a8e0745f68b40d.zip |
Rename broadcast to transmit for the connection/channel->subscriber communication
Disambiguate it from the broadcast to channel method used by the
broadcaster (which actually has several listeners, whereas a
connection/channel instance only ever has one listener – hence not much
of a BROADcast).
Diffstat (limited to 'lib/action_cable/channel')
-rw-r--r-- | lib/action_cable/channel/base.rb | 6 | ||||
-rw-r--r-- | lib/action_cable/channel/redis.rb | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index c39c2fcf0b..4c90849a06 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -79,10 +79,10 @@ module ActionCable end - def broadcast(data) + def transmit(data, via: nil) if authorized? - logger.info "#{channel_name} broadcasting #{data.inspect}" - connection.broadcast({ identifier: @channel_identifier, message: data }.to_json) + logger.info "#{channel_name} transmitting #{data.inspect} #{via}" + connection.transmit({ identifier: @channel_identifier, message: data }.to_json) else unauthorized end diff --git a/lib/action_cable/channel/redis.rb b/lib/action_cable/channel/redis.rb index b5fc812919..bdd6ab9dcf 100644 --- a/lib/action_cable/channel/redis.rb +++ b/lib/action_cable/channel/redis.rb @@ -29,8 +29,7 @@ module ActionCable protected def default_subscription_callback(channel) -> (message) do - logger.info "Received a message over the redis channel: #{channel}" - broadcast ActiveSupport::JSON.decode(message) + transmit ActiveSupport::JSON.decode(message), via: "incoming action from #{channel}" end end end |