fix(livekit): stable identity + room auto-cleanup

Use the member name as the LiveKit identity (was random per join) so a
refresh/rejoin replaces the existing session instead of leaving a ghost
participant in the room. Set roomConfig on the token (emptyTimeout 60s,
departureTimeout 20s) so empty rooms and departed participants clean up
promptly. Pods map 1:1 to a deterministic room name, so joins reuse the
same room rather than spawning new ones.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Kartikeya
2026-06-27 17:13:31 -07:00
parent b1b0761973
commit e29fabc3f1
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ export default function App() {
// Connect to a pod's LiveKit room and persist the session for refresh-resume.
async function connectToPod(podId: string, who: string) {
const identity = `${who}-${Math.random().toString(36).slice(2, 7)}`;
// Stable identity per member so a refresh/rejoin replaces the existing
// session instead of leaving a ghost participant behind.
const identity = who;
const result = await joinPod(podId, identity, who);
setRoom(result.room);
setDevMode(result.mode === 'dev');