Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

OpenTokSDK.Session

Represents an Vonage Video API session. Use the OpenTok.CreateSession method of the OpenTok class to create an Vonage Video API session. Use the Id property of the Session object to get the session ID. More...

Public Member Functions

string GenerateToken (Role role=Role.PUBLISHER, double expireTime=0, string data=null, List< string > initialLayoutClassList=null)
 Creates a token for connecting to an Vonage Video API session. In order to authenticate a user connecting to an Vonage Video API session that user must pass an authentication token along with the API key. More...

Properties

string Id [get, set]
 The session ID, which uniquely identifies the session. More...
int ApiKey [get]
 Your Vonage Video API key. More...
string ApiSecret [get]
 Your Vonage Video API secret. More...
string Location [get, set]
 The location hint IP address. More...
MediaMode MediaMode [get]
 Defines whether the session will transmit streams using the Vonage Video API Media Router (MediaMode.ROUTED) or attempt to transmit streams directly between clients (MediaMode.RELAYED). More...
ArchiveMode ArchiveMode [get]
 Defines whether the session is automatically archived (ArchiveMode.ALWAYS) or not (ArchiveMode.MANUAL). More...

Detailed Description

Represents an Vonage Video API session. Use the OpenTok.CreateSession method of the OpenTok class to create an Vonage Video API session. Use the Id property of the Session object to get the session ID.

Member Function Documentation

◆ GenerateToken()

string OpenTokSDK.Session.GenerateToken ( Role  role = Role.PUBLISHER,
double  expireTime = 0,
string  data = null,
List< string >  initialLayoutClassList = null 
)

Creates a token for connecting to an Vonage Video API session. In order to authenticate a user connecting to an Vonage Video API session that user must pass an authentication token along with the API key.

Parameters
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 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.
initialLayoutClassList
Returns
The token string.

Property Documentation

◆ ApiKey

int OpenTokSDK.Session.ApiKey

Your Vonage Video API key.

◆ ApiSecret

string OpenTokSDK.Session.ApiSecret

Your Vonage Video API secret.

◆ ArchiveMode

ArchiveMode OpenTokSDK.Session.ArchiveMode

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

◆ Id

string OpenTokSDK.Session.Id

The session ID, which uniquely identifies the session.

◆ Location

string OpenTokSDK.Session.Location

The location hint IP address.

◆ MediaMode

MediaMode OpenTokSDK.Session.MediaMode

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