Skip to content

moqtap-client

MoQT protocol engine — the outbound client stack behind moqtap’s tools.

crates.io | API docs

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.

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(())
}

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’s Connection. Exposes draft, set_observer, clear_observer, close. For draft-specific protocol calls (subscribe, fetch, publish) match on the variant.
  • AnyClientEvent — enum wrapping each draft’s ClientEvent.
  • AnyConnectionObserver — trait receiving AnyClientEvent. AnyConnection::set_observer installs a per-draft adapter on the inner connection.
  • Subscribe — with filter types, priority, group order
  • Fetch — retrieve historical objects by range
  • Namespace discovery — via SUBSCRIBE_NAMESPACE (or SUBSCRIBE_ANNOUNCES on draft-07)
  • Track status — query track availability
  • Publish — send objects

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 ConnectionObserver trait and the draft-agnostic AnyConnectionObserver

moqtap-client is NOT responsible for:

  • Accepting inbound connections — that’s moqtap-proxy
  • TLS certificate generation — that’s moqtap-proxy (behind cert-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)
FeatureDefaultDescription
draft07..draft17draft14 on by defaultEnable the matching draft’s module; forwards the feature to moqtap-codec
all-draftsnoEnables every draft
webtransportnoWebTransport client support via wtransport