aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/server.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-04-06 13:17:02 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-04-06 13:17:02 -0500
commit1c9d82dbf0e743534c5fa9be936eaa46c5b07523 (patch)
tree4fc5c31666fa033859150852cc5fd583420e32d8 /lib/action_cable/server.rb
parenteec92d0229a7bceb62d49d58c70b5629fe140d7f (diff)
downloadrails-1c9d82dbf0e743534c5fa9be936eaa46c5b07523.tar.gz
rails-1c9d82dbf0e743534c5fa9be936eaa46c5b07523.tar.bz2
rails-1c9d82dbf0e743534c5fa9be936eaa46c5b07523.zip
Add remote connection to talk over internal redis channel
Diffstat (limited to 'lib/action_cable/server.rb')
-rw-r--r--lib/action_cable/server.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/action_cable/server.rb b/lib/action_cable/server.rb
index 6e9265dc06..51e246c232 100644
--- a/lib/action_cable/server.rb
+++ b/lib/action_cable/server.rb
@@ -2,12 +2,12 @@ module ActionCable
class Server
cattr_accessor(:logger, instance_reader: true) { Rails.logger }
- attr_accessor :registered_channels, :worker_pool
+ attr_accessor :registered_channels, :redis_config
def initialize(redis_config:, channels:, worker_pool_size: 100, connection: Connection)
@redis_config = redis_config
@registered_channels = Set.new(channels)
- @worker_pool = ActionCable::Worker.pool(size: worker_pool_size)
+ @worker_pool_size = worker_pool_size
@connection_class = connection
end
@@ -15,9 +15,17 @@ module ActionCable
@connection_class.new(self, env).process
end
+ def worker_pool
+ @worker_pool ||= ActionCable::Worker.pool(size: @worker_pool_size)
+ end
+
def pubsub
@pubsub ||= EM::Hiredis.connect(@redis_config['url']).pubsub
end
+ def connection_identifiers
+ @connection_class.identifiers
+ end
+
end
end