aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection/base.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-04-09 17:26:18 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-04-09 17:26:18 -0500
commit005a99ebf687051df12af96e83b677e4abda9b21 (patch)
treebab802e1655546dd6bd7424bd61a97aa2fdb26f3 /lib/action_cable/connection/base.rb
parenta29034e47c45b6bb4ab4c4c06f11fe440b35f10f (diff)
downloadrails-005a99ebf687051df12af96e83b677e4abda9b21.tar.gz
rails-005a99ebf687051df12af96e83b677e4abda9b21.tar.bz2
rails-005a99ebf687051df12af96e83b677e4abda9b21.zip
Rename Registry to InternalChannel and remove dup methods
Diffstat (limited to 'lib/action_cable/connection/base.rb')
-rw-r--r--lib/action_cable/connection/base.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb
index b2d758a124..0c20f11502 100644
--- a/lib/action_cable/connection/base.rb
+++ b/lib/action_cable/connection/base.rb
@@ -1,10 +1,17 @@
module ActionCable
module Connection
class Base
- include Registry
+ include InternalChannel, Identifier
PING_INTERVAL = 3
+ class_attribute :identifiers
+ self.identifiers = Set.new
+
+ def self.identified_by(*identifiers)
+ self.identifiers += identifiers
+ end
+
attr_reader :env, :server
delegate :worker_pool, :pubsub, :logger, to: :server
@@ -89,7 +96,7 @@ module ActionCable
private
def initialize_connection
connect if respond_to?(:connect)
- register_connection
+ subscribe_to_internal_channel
@accept_messages = true
worker_pool.async.invoke(self, :received_data, @pending_messages.shift) until @pending_messages.empty?
@@ -97,7 +104,7 @@ module ActionCable
def on_connection_closed
cleanup_subscriptions
- cleanup_internal_redis_subscriptions
+ unsubscribe_from_internal_channel
disconnect if respond_to?(:disconnect)
end