wooden-librarian-60399
08/11/2025, 8:53 PMtall-airline-16756
08/11/2025, 8:53 PMtall-airline-16756
08/11/2025, 8:53 PMdisconnect_reason property on the Participant object. The DisconnectReason enum gives you a friendly, human-readable name for each reason.
Here’s a quick example for you:
from livekit import DisconnectReason
# Assuming 'participant' is your Participant object
reason = participant.disconnect_reason
if reason:
print(f"Disconnected with reason: {reason.name}")
Just a few things to keep in mind:
• The disconnect_reason property will be None if the participant is still connected.
• The name property turns the enum value into a readable string like "CLIENT_INITIATED" or "SERVER_SHUTDOWN".
• The DisconnectReason enum covers all the possible disconnect reasons, including CLIENT_INITIATED, SERVER_SHUTDOWN, and more.
If you have any more questions or need a hand with anything else, just let me know—I’m here to help!
Sources: livekit-rtc/livekit/rtc/participant.pyproud-lawyer-39815
10/21/2025, 12:35 AMtall-airline-16756
10/21/2025, 12:36 AM