pub struct Client { /* private fields */ }Expand description
A MoQ client session builder.
Implementations§
Source§impl Client
impl Client
Sourcepub fn with_publisher(self, publish: impl Consume<Consumer>) -> Self
pub fn with_publisher(self, publish: impl Consume<Consumer>) -> Self
Publish local broadcasts to the remote: the session reads from the given
origin (pass an origin::Producer or origin::Consumer by reference) and
forwards its announcements. Omit to publish nothing.
Sourcepub fn with_subscriber(self, subscribe: Producer) -> Self
pub fn with_subscriber(self, subscribe: Producer) -> Self
Subscribe to remote broadcasts: the session writes the broadcasts the
remote announces into this origin::Producer. Omit to subscribe to nothing.
Sourcepub fn with_stats(self, stats: Session) -> Self
pub fn with_stats(self, stats: Session) -> Self
Attach a per-connection stats::Session context. The session’s publish
(egress) and subscribe (ingress) origin handles are tagged with it, so all
traffic counters are attributed through the model for this session’s lifetime.
Pass stats::Session::default (a no-op context) to opt out.
Sourcepub fn with_origin(self, origin: Producer) -> Self
pub fn with_origin(self, origin: Producer) -> Self
Set both publish and subscribe from one shared origin::Producer.
Equivalent to with_publisher and
with_subscriber with the same origin.
Sourcepub fn with_versions(self, versions: Versions) -> Self
pub fn with_versions(self, versions: Versions) -> Self
Restrict which protocol versions to offer, in preference order. Defaults to every version this crate supports.
Sourcepub fn with_path(self, path: impl Into<String>) -> Self
pub fn with_path(self, path: impl Into<String>) -> Self
Set the request path to advertise in the SETUP (moq-lite-05 and every moq-transport draft we speak).
Only for transports that carry no request URI of their own (native QUIC, qmux over TCP/TLS, unix sockets), so the server learns which path the client wants. Bindings that already carry a URI (WebTransport, qmux over WebSocket) convey the path there and MUST NOT send this; a server is entitled to treat it as a protocol violation. An empty path is equivalent to omitting it. Ignored by versions with no in-band request path (lite 01-04).
Sourcepub fn with_cost(self, cost: u64) -> Self
pub fn with_cost(self, cost: u64) -> Self
Price this link, in the units the rest of the mesh uses (moq-lite-06+).
Every announcement crossing the connection adds this to its route cost, so
routing prefers cheap paths over short ones. Use 0 for a link that should
look free (a sibling in the same datacenter), and something large for one that
should be a last resort (a metered backbone). An unpriced link costs 1,
which makes the cost track the hop count and so reproduces plain
shortest-path routing.
The dialing side owns the price: it is declared in our SETUP so the server charges the same link the same amount. A server never sets one.