Skip to content

Latest commit

 

History

History
19 lines (18 loc) · 979 Bytes

readme.md

File metadata and controls

19 lines (18 loc) · 979 Bytes

OpenTok .Net Standard SDK

Implementation of the Tokbox OpenTok REST api and port of a few SDK methods, see https://github.com/opentok/Opentok-.NET-SDK

Scope

This SDK only implements the CreateSession and GenerateToken methods.

Usage

This SDK is created for usage with e.g. Azure Functions in mind

// generate session
string sessionId = await OpenTok.CreateSessionAsync(System.Environment.GetEnvironmentVariable("TOKBOX_SECRET"), 
                System.Environment.GetEnvironmentVariable("TOKBOX_APIKEY"));

// generate token
string apiKey = System.Environment.GetEnvironmentVariable("TOKBOX_APIKEY");
string secret = System.Environment.GetEnvironmentVariable("TOKBOX_SECRET");
string role = "publisher"; // "moderator";
string data = null; // see https://tokbox.com/developer/guides/create-token/ Connection data
double ttl =  24 * 60 * 60;
string token = OpenTok.GenerateToken(secret, apiKey, sessionId, role, data, ttl);