fix: comprehensive client-side session management for federated DM calls
Four fixes addressing the full state management problem: 1. Passive ready handler: no longer auto-connects to LiveKit on page refresh. Prevents identity conflicts when the same user has multiple sessions fighting for one LiveKit identity slot. The user must re-accept to join; state is shown but not acted on. 2. SoundController sync guard: incomingCallLoading/outgoingCallLoading refs prevent multiple playSound calls during async audio load. If call is cancelled while sound loads, stops it immediately on completion. Eliminates the "5 ringtones at once" bug. 3. Host dm_call_accepted broadcasts now include federatedCallId so all clients (including remote instances) can match the event. 4. Removed all diagnostic console.log statements.
This commit is contained in:
@@ -332,11 +332,10 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
||||
if (call.federatedCallId) {
|
||||
setFederatedCallId(call.federatedCallId);
|
||||
}
|
||||
if (connectFn && callDmId) {
|
||||
connectFn(callDmId, true).catch((err) => {
|
||||
console.error('[WS] DM call reconnect failed:', err);
|
||||
});
|
||||
}
|
||||
// PASSIVE: do NOT auto-connect to LiveKit on ready.
|
||||
// The user must click "Join" or re-accept. Auto-connecting causes
|
||||
// identity conflicts when the same user has multiple sessions —
|
||||
// both sessions fight for the same LiveKit identity slot.
|
||||
break;
|
||||
} else if (call.state === 'ringing' && call.callerId !== myId) {
|
||||
const dmCh = event.dmChannels?.find((d: any) => d.id === call.dmChannelId);
|
||||
|
||||
Reference in New Issue
Block a user