class OpenTok::Connections

A class for working with OpenTok connections.

Public Class Methods

new(client) click to toggle source

@private

# File lib/opentok/connections.rb, line 5
def initialize(client)
  @client = client
end

Public Instance Methods

forceDisconnect(session_id, connection_id ) click to toggle source

Force a client to disconnect from an OpenTok session.

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

@param [String] session_id The session ID of the OpenTok session. @param [String] connection_id The connection ID of the client in the session.

@raise [ArgumentError] The connection_id or session_id is invalid. @raise [OpenTokAuthenticationError] You are not authorized to disconnect the connection. Check your authentication credentials. @raise [OpenTokConnectionError] The client specified by the connection_id property is not connected to the session.

# 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