diff --git a/tests/client.py b/tests/client.py index c5adac7..1de2562 100644 --- a/tests/client.py +++ b/tests/client.py @@ -293,6 +293,7 @@ def __init__( self._connected: Event = Event() self._switched: bool = False + self._ws_close: bool = False self._closed: Event = Event() self._default_connection_timeout_s: float = 10.0 @@ -317,6 +318,7 @@ def __init__( self._connection.on_switched = self._on_switched self._connection.on_notify = self._on_notify self._connection.on_disconnect = self._on_disconnect + self._connection.on_ws_close = self._on_ws_close self._connection.on_track = self._on_track def connect(self) -> None: @@ -377,6 +379,10 @@ def connected(self) -> bool: def switched(self) -> bool: return self._switched + @property + def ws_close(self) -> bool: + return self._ws_close + @property def closed(self): return self._closed.is_set() @@ -445,6 +451,10 @@ def _on_disconnect(self, error_code: SoraSignalingErrorCode, message: str) -> No self._connected.clear() self._closed.is_set() + def _on_ws_close(self, code: int, reason: str) -> None: + print(f"WebSocket closed: code={code} reason={reason}") + self._ws_close = True + def _on_video_frame(self, frame: SoraVideoFrame) -> None: self._q_out.put(frame)