Skip to content

Commit 6689a3c

Browse files
authored
Add RoomEvent::TokenRefreshed (#803)
1 parent 8b39d03 commit 6689a3c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

livekit-ffi/protocol/room.proto

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ message RoomEvent {
359359
ParticipantMetadataChanged participant_metadata_changed = 17;
360360
ParticipantNameChanged participant_name_changed = 18;
361361
ParticipantAttributesChanged participant_attributes_changed = 19;
362-
ParticipantEncryptionStatusChanged participant_encryption_status_changed = 39;
363362
ConnectionQualityChanged connection_quality_changed = 20;
364363
ConnectionStateChanged connection_state_changed = 21;
365364
// Connected connected = 21;
@@ -385,6 +384,8 @@ message RoomEvent {
385384
RoomInfo moved = 37;
386385
// carry over all participant info updates, including sid
387386
ParticipantsUpdated participants_updated = 38;
387+
ParticipantEncryptionStatusChanged participant_encryption_status_changed = 39;
388+
TokenRefreshed token_refreshed = 40;
388389
}
389390
}
390391

@@ -561,6 +562,10 @@ message Disconnected {
561562
message Reconnecting {}
562563
message Reconnected {}
563564

565+
message TokenRefreshed {
566+
required string token = 1;
567+
}
568+
564569
message RoomEOS {}
565570

566571
message DataStream {

livekit-ffi/src/server/room.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,9 @@ async fn forward_event(
14261426
.into(),
14271427
);
14281428
}
1429+
RoomEvent::TokenRefreshed { token } => {
1430+
let _ = send_event(proto::TokenRefreshed { token: token.into() }.into());
1431+
}
14291432
_ => {
14301433
log::warn!("unhandled room event: {:?}", event);
14311434
}

livekit/src/room/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ pub enum RoomEvent {
234234
ParticipantsUpdated {
235235
participants: Vec<Participant>,
236236
},
237+
TokenRefreshed {
238+
token: String,
239+
},
237240
}
238241

239242
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
@@ -1741,6 +1744,8 @@ impl RoomSession {
17411744
for filter in registered_audio_filter_plugins().into_iter() {
17421745
filter.update_token(url.clone(), token.clone());
17431746
}
1747+
let event = RoomEvent::TokenRefreshed { token };
1748+
self.dispatcher.dispatch(&event);
17441749
}
17451750
}
17461751

0 commit comments

Comments
 (0)