Class: OpenTok::Connections

Inherits:
Object
  • Object
show all
Defined in:
lib/opentok/connections.rb

Overview

A class for working with OpenTok connections.

Instance Method Summary collapse

Instance Method Details

#forceDisconnect(session_id, connection_id) ⇒ Object

Force a client to disconnect from an OpenTok session.

A client must be actively connected to the OpenTok session for you to disconnect it.

Parameters:

  • session_id (String)

    The session ID of the OpenTok session.

  • connection_id (String)

    The connection ID of the client in the session.

Raises:

  • (ArgumentError)

    The connection_id or session_id is invalid.

  • (OpenTokAuthenticationError)

    You are not authorized to disconnect the connection. Check your authentication credentials.

  • (OpenTokConnectionError)

    The client specified by the connection_id property is not connected to the session.



20
21
22
23
24
25
# File 'lib/opentok/connections.rb', line 20

def forceDisconnect(session_id, connection_id )
  raise ArgumentError, "session_id not provided" if session_id.to_s.empty?
  raise ArgumentError, "connection_id not provided" if connection_id.to_s.empty?
  response = @client.forceDisconnect(session_id, connection_id)
  (200..300).include? response.code
end