fix: notify displaced tab when user joins voice from another session
When a user joins a voice channel while already connected from another tab, the server now sends a 'displaced' reason on voice_disconnected. The client tears down LiveKit and shows an informational toast.
This commit is contained in:
@@ -537,6 +537,14 @@ function handleVoiceJoin(event: Record<string, unknown>, userId: string): void {
|
||||
const left = connectionManager.leaveCurrentRoom(userId);
|
||||
if (left) {
|
||||
broadcastRoomLeave(left.roomId, left.room, userId);
|
||||
|
||||
// Notify all of the user's tabs so the displaced tab tears down LiveKit
|
||||
connectionManager.sendToUser(userId, {
|
||||
type: 'voice_disconnected',
|
||||
userId,
|
||||
channelId: left.roomId,
|
||||
reason: 'displaced',
|
||||
});
|
||||
}
|
||||
|
||||
// Cancel any ringing DM rooms where this user is the caller
|
||||
|
||||
Reference in New Issue
Block a user