Package com.opentok
Class Session
- java.lang.Object
-
- com.opentok.Session
-
public class Session extends java.lang.Object
Represents an OpenTok session. Use theOpenTok.createSession(SessionProperties properties)
method to create an OpenTok session. Use thegetSessionId()
method of the Session object to get the session ID.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
generateToken()
Generates the token for the session.java.lang.String
generateToken​(TokenOptions tokenOptions)
Creates a token for connecting to an OpenTok session.int
getApiKey()
Returns the OpenTok API key used to generate the session.SessionProperties
getProperties()
Returns the properties defining the session.java.lang.String
getSessionId()
Returns the session ID, which uniquely identifies the session.
-
-
-
Method Detail
-
getApiKey
public int getApiKey()
Returns the OpenTok API key used to generate the session.
-
getSessionId
public java.lang.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 java.lang.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(TokenOptions tokenOptions)
-
generateToken
public java.lang.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
-
-