From 6d31f64cf65e02fb14f0c1d737ccb90382f91cbe Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 8 Apr 2015 18:29:25 -0500 Subject: Log received redis channel messages --- lib/action_cable/channel/redis.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3