-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Summary
In the manual_start_stop_using_python/rtms.py example, the connect_to_signaling_websocket coroutine awaits the call to connect_to_media_websocket inside the signaling message loop (see around line 156). This effectively blocks the signaling loop on the media WebSocket. As a result, the signaling socket cannot respond to keep‑alive messages while the media socket is open.
Details
- At line 156,
schedule_rtms_stopis invoked to stop the RTMS after 10 seconds. - Within
connect_to_signaling_websocket, the async for‑loop awaitsconnect_to_media_websocketwhen a successful handshake is received. This call does not return until the media WebSocket closes, which prevents the signaling loop from handling keep‑alive messages (msg_type == 12) in a timely manner. - In a production implementation, establishing the media WebSocket should run concurrently (e.g., via
asyncio.create_taskor launching a new thread) so that the signaling socket can continue processing messages.
Request
Could we update the example to reflect this behaviour? Perhaps either:
- Add a comment explaining that developers should spawn
connect_to_media_websocketas a task or thread rather than awaiting it directly; or - Modify the sample code to use
asyncio.create_task(connect_to_media_websocket(...))to avoid blocking the signaling socket.
Metadata
Metadata
Assignees
Labels
No labels