what is the different between Participant Connecti...
# ask-ai
a
what is the different between Participant Connection Aborted and Participant Left in webhook
t
Thanks for reaching out, 文凱. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let me help clarify the difference between Participant Connection Aborted and Participant Left in LiveKit webhooks, so you can better understand what’s happening with your participants: • Participant Left: This event happens when a participant gracefully leaves the room after successfully connecting. Think of it as a smooth, expected exit—like when someone decides to leave the session or closes it properly. • Participant Connection Aborted: This one occurs when a participant doesn’t fully connect or their connection ends before it’s properly established. It usually points to an unexpected issue, like a sudden network drop or the client disconnecting early on in the joining process. Also, the
ParticipantInfo
object has a
disconnect_reason
field that can give you extra insight—for example,
JOIN_FAILURE
appears when the client couldn’t complete the connection. I hope this helps clear things up! If you have any more questions, feel free to ask. Sources: pkg/rtc/room.go | livekit-ffi/protocol/participant.proto
a
can i know all of the
disconnect_reason?
t
Hi there! I wanted to share the full list of
disconnect_reason
values in LiveKit to help you better understand what might be happening when a disconnection occurs: • UNKNOWN_REASON (0): Sometimes, the reason for disconnection isn’t clear, and it falls under this category. • CLIENT_INITIATED (1): This means the client decided to disconnect. • DUPLICATE_IDENTITY (2): Another participant with the same identity joined the room, causing this disconnect. • SERVER_SHUTDOWN (3): The server instance is shutting down, which leads to disconnection. • PARTICIPANT_REMOVED (4): This happens when RoomService.RemoveParticipant is called. • ROOM_DELETED (5): When RoomService.DeleteRoom is called, the room is deleted, causing disconnection. • STATE_MISMATCH (6): The client tried to resume a session, but the server didn’t recognize it. • JOIN_FAILURE (7): The client couldn’t fully connect to the room. • MIGRATION (8): For cloud-only setups, the server asked the participant to move the connection elsewhere. • SIGNAL_CLOSE (9): The signal websocket closed unexpectedly. • ROOM_CLOSED (10): The room closed because all Standard and Ingress participants left. • USER_UNAVAILABLE (11): The SIP callee didn’t respond in time. • USER_REJECTED (12): The SIP callee rejected the call (busy). • SIP_TRUNK_FAILURE (13): There was a SIP protocol failure or an unexpected response. • CONNECTION_TIMEOUT (14): The server timed out the participant’s session. • MEDIA_FAILURE (15): There was a media stream failure or timeout. These disconnect reasons are standardized across all LiveKit SDKs and protocols, so you can rely on them to diagnose issues consistently. If you have any questions about these or need further assistance, please feel free to reach out—I’m here to help! Sources: livekit-protocol/src/livekit.rs | packages/livekit-rtc/src/proto/participant_pb.ts | livekit/livekit_models.pb.go
a
why webhook send 5 times
t
I completely understand how repeated webhook notifications can feel a bit overwhelming. Just to share some helpful info: LiveKit webhooks might be sent up to 5 times because of a retry mechanism designed to make sure you don’t miss any important events. This happens if a webhook request doesn’t get delivered successfully at first—LiveKit tries again to handle any temporary network hiccups or if your endpoint is momentarily unavailable. Here’s a quick overview of how the retry logic works: • 2xx responses: These mark the event as successfully delivered, so no more retries are needed. • 5xx responses: These are seen as temporary issues, so LiveKit will retry with increasing delays (exponential backoff) to give it another chance. • 4xx responses: These are treated as permanent failures, so retries will stop to avoid unnecessary attempts. The great news is you can customize this behavior in your webhook settings, like adjusting the
MaxRetries
parameter to fit your needs. Plus, each webhook event comes with unique identifiers to help your system recognize and avoid processing duplicates. I hope this helps clarify things—please feel free to ask if you want to dive deeper or need any assistance! Sources: webhook/webhook_test.go | Webhooks | LiveKit Docs | Webhook & Event Notification System | livekit/livekit_composite | DeepWiki
a
how to use roomevent on client side and detect if it is DUPLICATE_IDENTITY when disconnect using typescript
t
I'm glad you're looking into how to detect a
DUPLICATE_IDENTITY
disconnect on the client side using
RoomEvent
in TypeScript. You can do this by listening to the
RoomEvent.Disconnected
event, which conveniently provides a
DisconnectReason
as an argument. Here's a friendly example to guide you through it:
Copy code
import { Room, RoomEvent, DisconnectReason } from 'livekit-client';

const room = new Room();

room.on(RoomEvent.Disconnected, (reason?: DisconnectReason) => {
  if (reason === DisconnectReason.DUPLICATE_IDENTITY) {
    console.log('Disconnected due to duplicate identity: another client with the same identity joined the room.');
    // This is a great place to handle the duplicate identity scenario,
    // like showing an alert or preventing reconnection, to keep things smooth for your users.
  } else {
    console.log('Disconnected for another reason:', reason);
  }
});
Just make sure to register this listener either right after connecting to the room or during your room initialization. When the
reason
is
DUPLICATE_IDENTITY
, it means another participant with the same identity has joined, and you can handle it accordingly. If you need any more help with this, feel free to ask—I'm here to support you! Sources: src/room/events.ts | Connecting to LiveKit | LiveKit Docs | agent-console/lib/event-definitions.tsx | livekit-android-sdk/src/main/java/io/livekit/android/events/RoomEvent.kt | Runtime/Scripts/Room/Room.cs