adorable-queen-16922
10/13/2025, 1:37 PMtall-airline-16756
10/13/2025, 1:37 PMtall-airline-16756
10/13/2025, 1:37 PMDUPLICATE_IDENTITY disconnect reason in your JavaScript application using LiveKit. To do this, you can listen to the disconnected event on the Room object. This event gives you a reason parameter of type DisconnectReason, which tells you why the participant was disconnected. You can check if it matches DisconnectReason.DUPLICATE_IDENTITY to handle that specific case.
Here’s a simple example to guide you:
import { DisconnectReason } from 'livekit-client';
room.on('disconnected', (reason) => {
if (reason === DisconnectReason.DUPLICATE_IDENTITY) {
console.log('Disconnected due to duplicate identity');
// You might want to show a friendly message to the user here
} else {
console.log('Disconnected for another reason:', reason);
}
});
This way, you can gracefully handle situations where someone else joins the room with the same identity, causing the previous participant to be disconnected. If you need any more help or have questions, feel free to ask—I'm here to support you!
Sources: Connecting to LiveKit | LiveKit Docs | agent-console/lib/event-types.ts | packages/livekit-rtc/src/proto/participant_pb.ts | lib/src/proto/livekit_models.pbenum.dart | Runtime/Scripts/Room.cs