\OpenTokSession

Represents an OpenTok session.

Use the \OpenTok\OpenTok->createSession() method to create an OpenTok session. Use the getSessionId() method of the Session object to get the session ID.

Summary

Methods
Properties
Constants
getSessionId()
getLocation()
getMediaMode()
getArchiveMode()
generateToken()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getSessionId()

getSessionId() 

Returns the session ID, which uniquely identifies the session.

getMediaMode()

getMediaMode() 

Returns MediaMode::RELAYED if the session's streams will be transmitted directly between peers; returns MediaMode::ROUTED if the session's streams will be transmitted using the OpenTok Media Router.

See OpenTok->createSession() and ArchiveMode.

getArchiveMode()

getArchiveMode() 

Defines whether the session is automatically archived (ArchiveMode::ALWAYS) or not (ArchiveMode::MANUAL).

See OpenTok->createSession() and ArchiveMode.

generateToken()

generateToken(array  $options = array()) : string

Creates a token for connecting to the session. In order to authenticate a user, the client passes a token when connecting to the session.

For testing, you can also generate tokens or by logging in to your Vonage Video API account.

Parameters

array $options

This array defines options for the token. This array include the following keys, all of which are optional:

  • 'role' (string) — One of the constants defined in the Role class. The default role is publisher.
  • 'expireTime' (int) — The timestamp for when the token expires, in milliseconds since the Unix epoch. The default expiration time is 24 hours after the token creation time. The maximum expiration time is 30 days after the token creation time.
  • 'data' (string) — A string containing connection metadata describing the end-user. For example, you can pass the user ID, name, or other data describing the end-user. The length of the string is limited to 1000 characters. This data cannot be updated once it is set.

Returns

string —

The token string.