Skip to content

Include new Rust token source - #36

Open
MaxHeimbrock wants to merge 2 commits into
mainfrom
max/include-token-source
Open

Include new Rust token source#36
MaxHeimbrock wants to merge 2 commits into
mainfrom
max/include-token-source

Conversation

@MaxHeimbrock

@MaxHeimbrock MaxHeimbrock commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Adds a tab to the connection options:

Screenshot 2026-08-13 at 11 14 30

@MaxHeimbrock
MaxHeimbrock force-pushed the max/include-token-source branch from 104e7e0 to 86cc4b7 Compare July 22, 2026 14:20
@MaxHeimbrock
MaxHeimbrock force-pushed the max/include-token-source branch from 82dc6df to c00f555 Compare August 3, 2026 14:54
@MaxHeimbrock
MaxHeimbrock marked this pull request as ready for review August 13, 2026 09:19
@MaxHeimbrock
MaxHeimbrock requested a review from ladvoc as a code owner August 13, 2026 09:19
Sandbox id works, but no other fields possible yet

Cargo changes for local dev

Also have fields for all fetch options

Some cleanup after CI complained

Adapt to fetch options builder

Using factory pattern

Make cargo toml use real deps

Needed for rebase

Adapt to stream options builder API

StreamTextOptions and StreamByteOptions no longer implement Default in
the local rust-sdks checkout; construct them via new_with_topic and
with_destination_identities instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Adapted to newest version

Adjusted to basic factory constructor

Working version matches

Format check
@MaxHeimbrock
MaxHeimbrock force-pushed the max/include-token-source branch from 344e61f to 9c3d871 Compare August 24, 2026 08:25
@MaxHeimbrock
MaxHeimbrock requested a review from 1egoman August 24, 2026 10:17

@1egoman 1egoman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me, called out a few nitpicks / small suggestions I think could make it a little more elegant!

Comment thread src/connect.rs
Comment on lines +55 to +65
Auth::TokenSource {
token_server_id,
options,
} => {
let token_source = development_token_server(token_server_id);
let response = token_source
.fetch(options)
.await
.map_err(|e| e.to_string())?;
Ok((response.server_url, response.participant_token))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Maybe make it Auth::DevelopmentTokenServer or similar to line up with the token source type?

Comment thread src/connect.rs
Comment on lines +116 to +125
token_server_id: String,
// Token-source fetch options (`ts_` to keep them apart from the API-key
// tab's identity/room). Empty means "omit, let the server default".
ts_room_name: String,
ts_participant_name: String,
ts_participant_identity: String,
ts_participant_metadata: String,
ts_agent_name: String,
ts_agent_metadata: String,
ts_agent_deployment: String,

@1egoman 1egoman Aug 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: It might be good to refactor all these token source metadata fields into a nested struct rather than adding the ts_ prefix.

Comment thread src/connect.rs
method: AuthMethod::default(),
url: env_or("LIVEKIT_URL", "ws://localhost:7880"),
token: env_or("LIVEKIT_TOKEN", ""),
token_server_id: "token-server-id".to_string(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this the right Default for this field? Or should it be an empty string?

Comment thread src/connect.rs
Comment on lines +211 to +227
let mut options = TokenSourceFetchOptions::new();
if let Some(v) = opt(&self.ts_room_name) {
options = options.with_room_name(v);
}
if let Some(v) = opt(&self.ts_participant_name) {
options = options.with_participant_name(v);
}
if let Some(v) = opt(&self.ts_participant_identity) {
options = options.with_participant_identity(v);
}
if let Some(v) = opt(&self.ts_participant_metadata) {
options = options.with_participant_metadata(v);
}
if let Some(v) = opt(&self.ts_agent_name) {
options = options.with_agent_name(v);
}
if let Some(v) = opt(&self.ts_agent_metadata) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(note that if you namespaced all this ts_ stuff under a new struct type, then you could encapsulate all this code in a impl From<NewStruct> for TokenSourceFetchOptions which might be a little cleaner)

Comment thread Cargo.toml Outdated
Co-authored-by: Ryan Gaus <rsg1egoman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants