close search


Public Member Functions

string GenerateToken (Role role=Role.PUBLISHER, double expireTime=0, string data=null)


string Id [get, set]
int ApiKey [get, set]
string ApiSecret [get, set]
string Location [get, set]
MediaMode MediaMode [get, set]
ArchiveMode ArchiveMode [get, set]

Detailed Description

Represents an OpenTok session. Use the CreateSession() method of the OpenTok class to create an OpenTok session. Use the Id property of the Session object to get the session ID.

Member Function Documentation

string OpenTokSDK.Session.GenerateToken ( Role  role = Role.PUBLISHER,
double  expireTime = 0,
string  data = null 

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.

roleThe role for the token. Valid values are defined in the Role enum:
  • Role.SUBSCRIBER — A subscriber can only subscribe to streams.

  • Role.PUBLISHER — A publisher can publish streams, subscribe to streams, and signal. (This is the default value if you do not specify a role.)

  • Role.MODERATOR — In addition to the privileges granted to a publisher, in clients using the OpenTok.js 2.2 library, a moderator can call the forceUnpublish() and forceDisconnect() method of the Session object.
expireTimeThe expiration time of the token, in seconds since the UNIX epoch. Pass in 0 to use the default expiration time of 24 hours after the token creation time. The maximum expiration time is 30 days after the creation time.
dataA 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.
The token string.

Property Documentation

int OpenTokSDK.Session.ApiKey

Your OpenTok API key.

string OpenTokSDK.Session.ApiSecret

Your OpenTok API secret.

ArchiveMode OpenTokSDK.Session.ArchiveMode

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

string OpenTokSDK.Session.Id

The session ID, which uniquely identifies the session.

string OpenTokSDK.Session.Location

The location hint IP address.

MediaMode OpenTokSDK.Session.MediaMode

Defines whether the session will transmit streams using the OpenTok Media Router (MediaMode.ROUTED) or attempt to transmit streams directly between clients (MediaMode.RELAYED).