diff options
Diffstat (limited to 'lib/action_cable/channel')
-rw-r--r-- | lib/action_cable/channel/redis.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/action_cable/channel/redis.rb b/lib/action_cable/channel/redis.rb index d47e503c51..fda55ec45d 100644 --- a/lib/action_cable/channel/redis.rb +++ b/lib/action_cable/channel/redis.rb @@ -10,7 +10,7 @@ module ActionCable end def subscribe_to(redis_channel, callback = nil) - callback ||= -> (message) { broadcast ActiveSupport::JSON.decode(message) } + callback ||= default_subscription_callback(redis_channel) @_redis_channels ||= [] @_redis_channels << [ redis_channel, callback ] @@ -27,6 +27,14 @@ module ActionCable end end end + + def default_subscription_callback(channel) + -> (message) do + logger.info "[ActionCable] Received a message over the redis channel: #{channel} (#{message})" + broadcast ActiveSupport::JSON.decode(message) + end + end + end end |