moqtap-client
MoQT protocol engine — the outbound client stack behind moqtap’s tools.
What it does
Section titled “What it does”All MoQT client-side protocol machinery: session state management, protocol flows, framed message I/O, and transport abstraction over QUIC and WebTransport. It is a pure code package with no UI — designed to be driven by another application (CLI, GUI, or web interface) that makes the decisions and presents the results.
Supports every MoQT draft from draft-07 through draft-17. Each draft lives in its own top-level module (draft07..draft17) with its own connection, endpoint state machine, event types, observer trait, and per-flow state machines. The transport module (QUIC / WebTransport) is shared across drafts.
Connect and subscribe (draft-14)
Section titled “Connect and subscribe (draft-14)”use moqtap_client::draft14::connection::{Connection, ClientConfig, TransportType};use moqtap_codec::version::DraftVersion;use moqtap_codec::types::*;
#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let config = ClientConfig { draft: DraftVersion::Draft14, additional_versions: Vec::new(), transport: TransportType::Quic, skip_cert_verification: true, ca_certs: Vec::new(), setup_parameters: Vec::new(), }; let mut conn = Connection::connect("127.0.0.1:4443", config).await?;
// Wait for MAX_REQUEST_ID from server, then subscribe let _ = conn.recv_and_dispatch().await?;
let _req_id = conn.subscribe( TrackNamespace(vec![b"live".to_vec()]), b"video".to_vec(), 128, GroupOrder::Ascending, FilterType::NextGroupStart, ).await?;
// Read incoming control messages and data streams... Ok(())}Draft-agnostic entry point
Section titled “Draft-agnostic entry point”The dispatch module is the shared facade for consumers that need to hold a MoQT connection without compile-time coupling to a single draft:
AnyConnection— enum wrapping each enabled draft’sConnection. Exposesdraft,set_observer,clear_observer,close. For draft-specific protocol calls (subscribe,fetch,publish) match on the variant.AnyClientEvent— enum wrapping each draft’sClientEvent.AnyConnectionObserver— trait receivingAnyClientEvent.AnyConnection::set_observerinstalls a per-draft adapter on the inner connection.
Capabilities
Section titled “Capabilities”- Subscribe — with filter types, priority, group order
- Fetch — retrieve historical objects by range
- Namespace discovery — via
SUBSCRIBE_NAMESPACE(orSUBSCRIBE_ANNOUNCESon draft-07) - Track status — query track availability
- Publish — send objects
Responsibility boundaries
Section titled “Responsibility boundaries”moqtap-client IS responsible for:
- Outbound QUIC and WebTransport connection lifecycle (connect, handshake, close)
- MoQT session state (setup exchange, active, draining, closed)
- All MoQT protocol flows (subscribe, fetch, publish, namespace, track status)
- Request ID allocation with parity enforcement and
MAX_REQUEST_ID - Framed message I/O (control messages and data streams)
- Per-draft wire formats for drafts 07 through 17
- TLS configuration (system roots, custom CAs, skip verification)
- Event emission via the per-draft
ConnectionObservertrait and the draft-agnosticAnyConnectionObserver
moqtap-client is NOT responsible for:
- Accepting inbound connections — that’s
moqtap-proxy - TLS certificate generation — that’s
moqtap-proxy(behindcert-gen) - Intercepting proxy logic — that’s
moqtap-proxy - Trace file I/O — that’s
moqtap-trace - Wire encoding/decoding — that’s
moqtap-codec - User interface (no stdout, no prompts, no progress bars)
Feature flags
Section titled “Feature flags”| Feature | Default | Description |
|---|---|---|
draft07..draft17 | draft14 on by default | Enable the matching draft’s module; forwards the feature to moqtap-codec |
all-drafts | no | Enables every draft |
webtransport | no | WebTransport client support via wtransport |