From 9f4e99310bd6ae5f0e4ff86450f2ab4757103cf0 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 14 Oct 2025 14:32:56 -0400 Subject: [PATCH] Elaborate on a TODO for preloading JWT tokens --- src/state/Connection.ts | 1 - src/state/PublishConnection.ts | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/state/Connection.ts b/src/state/Connection.ts index bb18daaa..2f294057 100644 --- a/src/state/Connection.ts +++ b/src/state/Connection.ts @@ -120,7 +120,6 @@ export class Connection { state: "FetchingConfig", focus: this.localTransport, }); - // TODO could this be loaded earlier to save time? const { url, jwt } = await this.getSFUConfigWithOpenID(); // If we were stopped while fetching the config, don't proceed to connect if (this.stopped) return; diff --git a/src/state/PublishConnection.ts b/src/state/PublishConnection.ts index 52db6968..1bb79211 100644 --- a/src/state/PublishConnection.ts +++ b/src/state/PublishConnection.ts @@ -105,6 +105,10 @@ export class PublishConnection extends Connection { // Observe mute state changes and update LiveKit microphone/camera states accordingly this.observeMuteStates(this.scope); + // TODO: This will fetch the JWT token. Perhaps we could keep it preloaded + // instead? This optimization would only be safe for a publish connection, + // because we don't want to leak the user's intent to perhaps join a call to + // remote servers before they actually commit to it. await super.start(); if (this.stopped) return;