aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/channel
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-04-07 10:11:46 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-04-07 10:11:46 -0500
commit6127d0cda4d60c7b30ee1fb40006da11e04512d0 (patch)
treec6905ea6b5414a64a687dea12cb0ea4631d2e0a1 /lib/action_cable/channel
parentbdbbe18f3cc527b121bbb2f402898caf4c2fbb15 (diff)
parentfb797ad1f1c3b0d96968c5feef783a2b8fe07eed (diff)
downloadrails-6127d0cda4d60c7b30ee1fb40006da11e04512d0.tar.gz
rails-6127d0cda4d60c7b30ee1fb40006da11e04512d0.tar.bz2
rails-6127d0cda4d60c7b30ee1fb40006da11e04512d0.zip
Merge branch 'connection-management'
Diffstat (limited to 'lib/action_cable/channel')
-rw-r--r--lib/action_cable/channel/redis.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/action_cable/channel/redis.rb b/lib/action_cable/channel/redis.rb
index bdbd3c95b1..2691a3b145 100644
--- a/lib/action_cable/channel/redis.rb
+++ b/lib/action_cable/channel/redis.rb
@@ -6,11 +6,10 @@ module ActionCable
included do
on_unsubscribe :unsubscribe_from_redis_channels
+ delegate :pubsub, to: :connection
end
def subscribe_to(redis_channel, callback = nil)
- raise "`ActionCable::Server.pubsub` class method is not defined" unless connection.class.respond_to?(:pubsub)
-
callback ||= -> (message) { broadcast ActiveSupport::JSON.decode(message) }
@_redis_channels ||= []
@_redis_channels << [ redis_channel, callback ]
@@ -24,10 +23,6 @@ module ActionCable
@_redis_channels.each { |channel, callback| pubsub.unsubscribe_proc(channel, callback) }
end
end
-
- def pubsub
- connection.class.pubsub
- end
end
end