Package com.opentok

Class Session

java.lang.Object
com.opentok.Session

public class Session extends Object
Represents an OpenTok session. Use the OpenTok.createSession(SessionProperties properties) method to create an OpenTok session. Use the getSessionId() method of the Session object to get the session ID.
  • Method Details

    • getApplicationId

      public String getApplicationId()
      Gets the Vonage application ID, if applicable.
      Returns:
      The Vonage application UUID as a string, or null if using OpenTok API key and secret.
      Since:
      4.15.0
    • getApiKey

      public int getApiKey()
      Returns the OpenTok API key used to generate the session.
    • getSessionId

      public String getSessionId()
      Returns the session ID, which uniquely identifies the session.
    • getProperties

      public SessionProperties getProperties()
      Returns the properties defining the session. These properties include:
      • The location hint IP address.
      • Whether the session's streams will be transmitted directly between peers or using the OpenTok media server.
    • generateToken

      public String generateToken() throws OpenTokException
      Generates the token for the session. The role is set to publisher, the token expires in 24 hours, and there is no connection data.
      Returns:
      The token string.
      Throws:
      OpenTokException
      See Also:
    • generateToken

      public String generateToken(TokenOptions tokenOptions) throws OpenTokException
      Creates a token for connecting to an OpenTok session. In order to authenticate a user connecting to an OpenTok session that user must pass an authentication token along with the API key.
      Parameters:
      tokenOptions - This TokenOptions object defines options for the token. These include the following:
      • The role of the token (subscriber, publisher, or moderator)
      • The expiration time of the token
      • Connection data describing the end-user
      Returns:
      The token string.
      Throws:
      OpenTokException