Package com.opentok
Class Session
java.lang.Object
com.opentok.Session
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 Summary
Modifier and TypeMethodDescriptionGenerates the token for the session.generateToken
(TokenOptions tokenOptions) Creates a token for connecting to an OpenTok session.int
Returns the OpenTok API key used to generate the session.Gets the Vonage application ID, if applicable.Returns the properties defining the session.Returns the session ID, which uniquely identifies the session.
-
Method Details
-
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
Returns the session ID, which uniquely identifies the session. -
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
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
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
-