module ActionCable::Server::Connections

def add_connection(connection)

def add_connection(connection)
  connections << connection
end

def connections

def connections
  @connections ||= []
end

def open_connections_statistics

def open_connections_statistics
  connections.map(&:statistics)
end

def remove_connection(connection)

def remove_connection(connection)
  connections.delete connection
end

def setup_heartbeat_timer

disconnect.
then can't rely on being able to communicate with the connection. To solve this, a 3 second heartbeat runs on all connections. If the beat fails, we automatically
WebSocket connection implementations differ on when they'll mark a connection as stale. We basically never want a connection to go stale, as you
def setup_heartbeat_timer
  @heartbeat_timer ||= event_loop.timer(BEAT_INTERVAL) do
    event_loop.post { connections.map(&:beat) }
  end
end