diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2015-04-09 18:50:22 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2015-04-09 18:50:22 -0500 |
commit | 033de15758bfb57a43e5e903fc4a1f6fa9fac118 (patch) | |
tree | c5b343cac076657b029724e338ee6a245845da0c /lib/action_cable/server.rb | |
parent | 005a99ebf687051df12af96e83b677e4abda9b21 (diff) | |
download | rails-033de15758bfb57a43e5e903fc4a1f6fa9fac118.tar.gz rails-033de15758bfb57a43e5e903fc4a1f6fa9fac118.tar.bz2 rails-033de15758bfb57a43e5e903fc4a1f6fa9fac118.zip |
Collect information about all the open connections and a method to fetch that
Diffstat (limited to 'lib/action_cable/server.rb')
-rw-r--r-- | lib/action_cable/server.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/action_cable/server.rb b/lib/action_cable/server.rb index 507b154e0d..a867d8578f 100644 --- a/lib/action_cable/server.rb +++ b/lib/action_cable/server.rb @@ -10,6 +10,8 @@ module ActionCable @worker_pool_size = worker_pool_size @connection_class = connection + @connections = [] + logger.info "[ActionCable] Initialized server (redis_config: #{@redis_config.inspect}, worker_pool_size: #{@worker_pool_size})" end @@ -33,5 +35,17 @@ module ActionCable @connection_class.identifiers end + def add_connection(connection) + @connections << connection + end + + def remove_connection(connection) + @connections.delete connection + end + + def open_connections_statistics + @connections.map(&:statistics) + end + end end |