Table of Contents

Class BaseService

Namespace
Livekit.Server.Sdk.Dotnet
Assembly
LivekitApi.dll

Base class of the service clients: holds the credentials and the HttpClient, signs every call with a short-lived token and sends it as a Twirp request.

public class BaseService
Inheritance
BaseService
Derived
Inherited Members

Constructors

BaseService(string, string, string, HttpClient)

Stores the credentials and the HttpClient the requests are sent with.

public BaseService(string host, string apiKey = null, string apiSecret = null, HttpClient client = null)

Parameters

host string

URL of the LiveKit server, http(s):// or ws(s)://; a subpath such as https://host/livekit is kept.

apiKey string

API key; the LIVEKIT_API_KEY environment variable when omitted.

apiSecret string

API secret; the LIVEKIT_API_SECRET environment variable when omitted.

client HttpClient

Optional HttpClient to send the requests with. The SDK never modifies it, so it can be shared with other clients and code.

Fields

httpClient

The HttpClient the requests are sent with: the one supplied to the constructor, or one owned by the SDK (which shares a connection pool with the other SDK-owned clients).

protected readonly HttpClient httpClient

Field Value

HttpClient

Methods

AuthHeader(VideoGrants)

Builds the bearer token of a call that needs videoGrants, valid for DefaultTtl.

protected string AuthHeader(VideoGrants videoGrants)

Parameters

videoGrants VideoGrants

Room permissions the call needs.

Returns

string

The signed JWT, sent as bearer token.

AuthHeader(VideoGrants, SIPGrants)

Builds the bearer token of a SIP call that needs videoGrants and sipGrants, valid for DefaultTtl.

protected string AuthHeader(VideoGrants videoGrants, SIPGrants sipGrants)

Parameters

videoGrants VideoGrants

Room permissions the call needs.

sipGrants SIPGrants

SIP permissions the call needs.

Returns

string

The signed JWT, sent as bearer token.