Skip to content

Commit 2b3ba0b

Browse files
committed
feat: add return type and connection check to coordinator_ws
Return Optional[StreamAPIWS] and check _connected before returning, so callers get None instead of a disconnected client.
1 parent 810998f commit 2b3ba0b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

getstream/video/rtc/connection_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,17 @@ def ws_client(self, value):
621621
self._ws_client = value
622622

623623
@property
624-
def coordinator_ws(self):
624+
def coordinator_ws(self) -> Optional[StreamAPIWS]:
625625
"""The coordinator WebSocket receiving call-scoped events.
626626
627627
Available after connecting. Use ``ws.on()`` or ``ws.on_wildcard()``
628628
to subscribe to events. Send custom events via ``call.send_call_event()``.
629629
630630
Returns None if not connected.
631631
"""
632-
return self._coordinator_ws_client
632+
if self._coordinator_ws_client and self._coordinator_ws_client._connected:
633+
return self._coordinator_ws_client
634+
return None
633635

634636
# Publisher / Subscriber peer-connection shortcuts
635637
@property

0 commit comments

Comments
 (0)