Sha256: 82eb84f5fb69ffae90ecb0cfd17db5553f83cc1a70573a5777b0cb684b1c2c68

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

module OpenTok
  #  A class for working with OpenTok connections.
  class Connections
    # @private
    def initialize(client)
      @client = client
    end

    # 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.
    #
    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

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opentok-4.2.0 lib/opentok/connections.rb
opentok-4.1.2 lib/opentok/connections.rb
opentok-4.1.1 lib/opentok/connections.rb
opentok-4.1.0 lib/opentok/connections.rb
opentok-4.0.1 lib/opentok/connections.rb
opentok-4.0.0 lib/opentok/connections.rb
opentok-3.1.0 lib/opentok/connections.rb