Skip to content

Commit 677fb78

Browse files
Update token source examples for create factories
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 6876b08 commit 677fb78

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

token_source/token_source_caching.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ bool cachingTokenSourceConnect() {
4848

4949
std::cout << "Caching token source wrapping endpoint: " << endpoint_url << "\n";
5050

51-
// Build the inner source, then wrap it. CachingTokenSource::wrap takes
51+
// Build the inner source, then wrap it. CachingTokenSource::create takes
5252
// ownership of the inner source via unique_ptr.
53-
auto inner = livekit::EndpointTokenSource::fromUrl(endpoint_url, endpointOptionsFromEnv());
54-
auto token_source = livekit::CachingTokenSource::wrap(std::move(inner));
53+
auto inner = livekit::EndpointTokenSource::create(endpoint_url, endpointOptionsFromEnv());
54+
auto token_source = livekit::CachingTokenSource::create(std::move(inner));
5555

5656
livekit::TokenRequestOptions request_options;
5757
request_options.participant_identity = "robot-a";

token_source/token_source_custom.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ bool customTokenSourceConnect() {
5555
// The callback is invoked for each fetch with the request options. Here we
5656
// pretend to call an internal service; in a real app this is where you would
5757
// talk to your own auth backend.
58-
auto token_source = livekit::CustomTokenSource::fromCallback(
58+
auto token_source = livekit::CustomTokenSource::create(
5959
[](const livekit::TokenRequestOptions& options) -> std::future<TokenResult> {
6060
(void)options; // A real backend would honor these (room, identity, ...).
6161

token_source/token_source_endpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bool endpointTokenSourceConnect() {
5050
std::cout << "Endpoint token source: " << endpoint_options.method << " " << endpoint_url << " ("
5151
<< endpoint_options.headers.size() << " custom header(s))\n";
5252

53-
auto token_source = livekit::EndpointTokenSource::fromUrl(endpoint_url, std::move(endpoint_options));
53+
auto token_source = livekit::EndpointTokenSource::create(endpoint_url, std::move(endpoint_options));
5454

5555
// These options are sent to your endpoint, which embeds them into the JWT.
5656
livekit::TokenRequestOptions request_options;

token_source/token_source_literal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool literalTokenSourceConnect() {
4545

4646
// Each fetch() returns these exact credentials; nothing is requested over the
4747
// network. Room and participant identity are encoded in the token.
48-
auto token_source = livekit::LiteralTokenSource::fromValue(url, token);
48+
auto token_source = livekit::LiteralTokenSource::create(url, token);
4949

5050
livekit::Room room;
5151
ParticipantLogDelegate delegate;

token_source/token_source_sandbox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool sandboxTokenSourceConnect() {
4545

4646
// POSTs to cloud-api.livekit.io/api/v2/sandbox/connection-details with
4747
// X-Sandbox-ID set from LIVEKIT_SANDBOX_ID.
48-
auto token_source = livekit::SandboxTokenSource::fromSandboxId(sandbox_id);
48+
auto token_source = livekit::SandboxTokenSource::create(sandbox_id);
4949

5050
livekit::TokenRequestOptions request_options;
5151
request_options.participant_identity = "robot-a";

0 commit comments

Comments
 (0)