Join Scaling with Python WebRTC¶
Python applications can deploy a pipeline through Entry HTTP, obtain a member admission ticket, and negotiate WebRTC with the selected runner. The Python control package supplies the backend gRPC attach; the example uses HTTP, WebSocket signaling, and aiortc for the other boundaries.
Prepare the media client¶
Use the media profile with the matching checkout client, aiortc==1.14.0, av==16.1.0, and websockets==15.0.1. Keep run.py and media_client.py together. You also need the echo manifest, and Entry/runner binaries identified by your runtime build.
This creates and deletes a new local test pipeline and session. It opens no microphone or speaker. Ports and names are generated for each run, and all waits are bounded. Run --tools separately when validating the worker RPC and application endpoint graph.
Follow the admission flow¶
- The harness generates an ephemeral signing key and writes only its public key for Entry. Short-lived backend and client JWTs remain in memory.
- A backend token authorizes
PUT /pipelines/{name}on the admin listener. - A client token scoped to pipeline, session and member authorizes
POST /joinon the public listener. - The client connects to the returned
signal_urland sendspeer.announcewith the ticket. It uses the admittedpeer_idreturned by the runner. - The client adds an audio track, creates the
datachannel, gathers candidates, and sendspeer.offertoremotemedia-server. It applies the answer and subsequentpeer.ice_candidatenotifications. - The client sends a 440 Hz tone and receives echoed audio. Finally it closes tracks, tasks, socket and peer connection; the harness deletes the session and pipeline and stops its owned servers.
Treat tickets as credentials. The report retains no private signing key, JWT or join ticket. For an existing service, follow its TLS, ICE/STUN/TURN and authorization configuration; this host-interface test does not establish internet or NAT traversal.
Match the room's output stream¶
The graph is echo: PassThrough → audio: FastResampleNode. The resampler is configured with target_rate: 48000 and output_stream_id: default. Incoming room audio carries the participant's stream ID; a plain echo preserves it. The tested room's outgoing audio track is named default, so the graph must map the output to that name. Without the mapping, the runner logged that no track matched and dropped the samples.
The client adds audio before creating its data channel when using RTCBundlePolicy.MAX_BUNDLE. Reversing that order with the pinned aiortc version left this test's ICE state at new. Keep the tested order and consume candidate notifications throughout the connection. See the official aiortc API for the peer connection and media track contracts.
What the check establishes¶
The recorded local run reaches connection: connected, data_channel: open, and receives 20 decoded 48 kHz audio frames with nonzero RMS and a spectral peak at 440 Hz. It verifies authentication rejection without a backend token and confirms owned server processes stop. It does not measure perceived quality, device latency, sustained operation, packet-loss resilience, or a remote physical network.
Inspect the generated result.json, entry.log, and runner.log beneath the selected output directory. A successful join alone does not establish successful ICE, codec negotiation, or media delivery.
Source references: remotemedia-scaling/crates/entry/src/signaling.rs · remotemedia-scaling/docs/tokens.md · remotemedia-scaling/binaries/entry/src/main.rs · remotemedia-scaling/crates/runner/src/room_host.rs (base revision; reviewed with local changes) · remotemedia-scaling/crates/entry/tests/support/room_client.rs (base revision; reviewed with local changes) · remotemedia-sdk-base/src/nodes/streaming_registry/mod.rs (base revision; reviewed with local changes)