aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/channel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_cable/channel')
-rw-r--r--lib/action_cable/channel/base.rb6
-rw-r--r--lib/action_cable/channel/redis.rb3
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