Skip to content

Commit 692cb12

Browse files
committed
adding disconnect reason
1 parent 66c2121 commit 692cb12

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

livekit-rtc/livekit/rtc/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ._proto import stats_pb2 as stats
1818
from ._proto.e2ee_pb2 import EncryptionState, EncryptionType
19-
from ._proto.participant_pb2 import ParticipantKind
19+
from ._proto.participant_pb2 import ParticipantKind, DisconnectReason
2020
from ._proto.room_pb2 import (
2121
ConnectionQuality,
2222
ConnectionState,
@@ -98,6 +98,7 @@
9898
"LocalParticipant",
9999
"Participant",
100100
"ParticipantKind",
101+
"DisconnectReason",
101102
"RemoteParticipant",
102103
"ConnectError",
103104
"Room",

livekit-rtc/livekit/rtc/participant.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ def kind(self) -> proto_participant.ParticipantKind.ValueType:
107107
"""Participant's kind (e.g., regular participant, ingress, egress, sip, agent)."""
108108
return self._info.kind
109109

110+
@property
111+
def disconnect_reason(self) -> proto_participant.DisconnectReason.ValueType:
112+
"""Reason for the participant's disconnection."""
113+
return self._info.disconnect_reason
114+
110115

111116
class LocalParticipant(Participant):
112117
"""Represents the local participant in a room."""
@@ -413,7 +418,8 @@ async def run_handler():
413418
response_error = error
414419
except Exception as error:
415420
logger.exception(
416-
f"Uncaught error returned by RPC handler for {method}. Returning APPLICATION_ERROR instead. Original error: {error}",
421+
f"Uncaught error returned by RPC handler for {
422+
method}. Returning APPLICATION_ERROR instead. Original error: {error}",
417423
)
418424
response_error = RpcError._built_in(
419425
RpcError.ErrorCode.APPLICATION_ERROR
@@ -432,7 +438,8 @@ async def run_handler():
432438

433439
if res.rpc_method_invocation_response.error:
434440
logger.exception(
435-
f"error sending rpc method invocation response: {res.rpc_method_invocation_response.error}"
441+
f"error sending rpc method invocation response: {
442+
res.rpc_method_invocation_response.error}"
436443
)
437444

438445
async def set_metadata(self, metadata: str) -> None:

livekit-rtc/livekit/rtc/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.18.4"
1+
__version__ = "0.19.0"

0 commit comments

Comments
 (0)