Skip to content

Commit

Permalink
adding disconnect reason
Browse files Browse the repository at this point in the history
  • Loading branch information
davidzhao committed Dec 29, 2024
1 parent 66c2121 commit 692cb12
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion livekit-rtc/livekit/rtc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from ._proto import stats_pb2 as stats
from ._proto.e2ee_pb2 import EncryptionState, EncryptionType
from ._proto.participant_pb2 import ParticipantKind
from ._proto.participant_pb2 import ParticipantKind, DisconnectReason
from ._proto.room_pb2 import (
ConnectionQuality,
ConnectionState,
Expand Down Expand Up @@ -98,6 +98,7 @@
"LocalParticipant",
"Participant",
"ParticipantKind",
"DisconnectReason",
"RemoteParticipant",
"ConnectError",
"Room",
Expand Down
11 changes: 9 additions & 2 deletions livekit-rtc/livekit/rtc/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def kind(self) -> proto_participant.ParticipantKind.ValueType:
"""Participant's kind (e.g., regular participant, ingress, egress, sip, agent)."""
return self._info.kind

@property
def disconnect_reason(self) -> proto_participant.DisconnectReason.ValueType:
"""Reason for the participant's disconnection."""
return self._info.disconnect_reason


class LocalParticipant(Participant):
"""Represents the local participant in a room."""
Expand Down Expand Up @@ -413,7 +418,8 @@ async def run_handler():
response_error = error
except Exception as error:
logger.exception(
f"Uncaught error returned by RPC handler for {method}. Returning APPLICATION_ERROR instead. Original error: {error}",
f"Uncaught error returned by RPC handler for {
method}. Returning APPLICATION_ERROR instead. Original error: {error}",
)
response_error = RpcError._built_in(
RpcError.ErrorCode.APPLICATION_ERROR
Expand All @@ -432,7 +438,8 @@ async def run_handler():

if res.rpc_method_invocation_response.error:
logger.exception(
f"error sending rpc method invocation response: {res.rpc_method_invocation_response.error}"
f"error sending rpc method invocation response: {
res.rpc_method_invocation_response.error}"
)

async def set_metadata(self, metadata: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion livekit-rtc/livekit/rtc/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.18.4"
__version__ = "0.19.0"

0 comments on commit 692cb12

Please sign in to comment.