aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection/internal_channel.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2015-07-07 22:36:18 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2015-07-07 22:36:18 +0200
commit338e28de15d49b8f49b5694e0e1a5e31d571428c (patch)
treecd59a64a62fddd302007258acf63a45fd3a21a00 /lib/action_cable/connection/internal_channel.rb
parent7bcc0e48e48e1b70aaac4db59388e102608ae315 (diff)
downloadrails-338e28de15d49b8f49b5694e0e1a5e31d571428c.tar.gz
rails-338e28de15d49b8f49b5694e0e1a5e31d571428c.tar.bz2
rails-338e28de15d49b8f49b5694e0e1a5e31d571428c.zip
Make the entire internal channel private
Diffstat (limited to 'lib/action_cable/connection/internal_channel.rb')
-rw-r--r--lib/action_cable/connection/internal_channel.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/action_cable/connection/internal_channel.rb b/lib/action_cable/connection/internal_channel.rb
index 70e5e58373..baf916dffa 100644
--- a/lib/action_cable/connection/internal_channel.rb
+++ b/lib/action_cable/connection/internal_channel.rb
@@ -3,28 +3,28 @@ module ActionCable
module InternalChannel
extend ActiveSupport::Concern
- def internal_redis_channel
- "action_cable/#{connection_identifier}"
- end
+ private
+ def internal_redis_channel
+ "action_cable/#{connection_identifier}"
+ end
- def subscribe_to_internal_channel
- if connection_identifier.present?
- callback = -> (message) { process_internal_message(message) }
- @_internal_redis_subscriptions ||= []
- @_internal_redis_subscriptions << [ internal_redis_channel, callback ]
+ def subscribe_to_internal_channel
+ if connection_identifier.present?
+ callback = -> (message) { process_internal_message(message) }
+ @_internal_redis_subscriptions ||= []
+ @_internal_redis_subscriptions << [ internal_redis_channel, callback ]
- pubsub.subscribe(internal_redis_channel, &callback)
- logger.info "Registered connection (#{connection_identifier})"
+ pubsub.subscribe(internal_redis_channel, &callback)
+ logger.info "Registered connection (#{connection_identifier})"
+ end
end
- end
- def unsubscribe_from_internal_channel
- if @_internal_redis_subscriptions.present?
- @_internal_redis_subscriptions.each { |channel, callback| pubsub.unsubscribe_proc(channel, callback) }
+ def unsubscribe_from_internal_channel
+ if @_internal_redis_subscriptions.present?
+ @_internal_redis_subscriptions.each { |channel, callback| pubsub.unsubscribe_proc(channel, callback) }
+ end
end
- end
- private
def process_internal_message(message)
message = ActiveSupport::JSON.decode(message)