Fix notifications for membership changes too

This commit is contained in:
Conrad Irwin 2023-10-19 14:41:20 -06:00
parent 0eff7c6ca9
commit aa4b8d7246
12 changed files with 470 additions and 260 deletions

View file

@ -12,6 +12,7 @@ pub trait Client: Send + Sync {
async fn delete_room(&self, name: String) -> Result<()>;
async fn remove_participant(&self, room: String, identity: String) -> Result<()>;
fn room_token(&self, room: &str, identity: &str) -> Result<String>;
fn guest_token(&self, room: &str, identity: &str) -> Result<String>;
}
#[derive(Clone)]
@ -138,4 +139,13 @@ impl Client for LiveKitClient {
token::VideoGrant::to_join(room),
)
}
fn guest_token(&self, room: &str, identity: &str) -> Result<String> {
token::create(
&self.key,
&self.secret,
Some(identity),
token::VideoGrant::for_guest(room),
)
}
}

View file

@ -57,6 +57,15 @@ impl<'a> VideoGrant<'a> {
..Default::default()
}
}
pub fn for_guest(room: &'a str) -> Self {
Self {
room: Some(Cow::Borrowed(room)),
room_join: Some(true),
can_subscribe: Some(true),
..Default::default()
}
}
}
pub fn create(