Skip to content

Commit

Permalink
[e2e] recvonly にも ws_close 追加
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Sep 28, 2024
1 parent 7fcaf2a commit 082e4c8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 082e4c8

Please sign in to comment.