1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/action_cable/server/connections.rb

24 lines
737 B
Ruby
Raw Normal View History

module ActionCable
module Server
2015-07-07 17:13:00 -04:00
# Collection class for all the connections that's been established on this specific server. Remember, usually you'll run many cable servers, so
# you can't use this collection as an full list of all the connections established against your application. Use RemoteConnections for that.
# As such, this is primarily for internal use.
module Connections
def connections
@connections ||= []
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
end