Class: ActionCable::RemoteConnections::RemoteConnection

Inherits:
Object
  • Object
show all
Includes:
Connection::Identification, Connection::InternalChannel
Defined in:
lib/action_cable/remote_connections.rb

Overview

Represents a single remote connection found via ActionCable.server.remote_connections.where(*). Exists for the solely for the purpose of calling #disconnect on that connection.

Defined Under Namespace

Classes: InvalidIdentifiersError

Instance Method Summary collapse

Methods included from Connection::Identification

#connection_identifier

Constructor Details

#initialize(server, ids) ⇒ RemoteConnection

Returns a new instance of RemoteConnection.


35
36
37
38
# File 'lib/action_cable/remote_connections.rb', line 35

def initialize(server, ids)
  @server = server
  set_identifier_instance_vars(ids)
end

Instance Method Details

#disconnectObject

Uses the internal channel to disconnect the connection.


41
42
43
# File 'lib/action_cable/remote_connections.rb', line 41

def disconnect
  server.broadcast internal_redis_channel, type: 'disconnect'
end

#identifiersObject

Returns all the identifiers that were applied to this connection.


46
47
48
# File 'lib/action_cable/remote_connections.rb', line 46

def identifiers
  server.connection_identifiers
end