pub struct Client { /* private fields */ }Expand description
Client for establishing MoQ connections over QUIC, WebTransport, or WebSocket.
Create via ClientConfig::init or Client::new.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Create a new client
pub fn with_publish(self, publish: impl Into<Option<OriginConsumer>>) -> Self
pub fn with_consume(self, consume: impl Into<Option<OriginProducer>>) -> Self
Sourcepub fn with_stats(self, stats: StatsHandle) -> Self
pub fn with_stats(self, stats: StatsHandle) -> Self
Attach a tier-scoped moq_net::StatsHandle to all sessions opened by this client.
Sourcepub fn reconnect(&self, url: Url) -> Reconnect
pub fn reconnect(&self, url: Url) -> Reconnect
Start a background reconnect loop that connects to the given URL, waits for the session to close, then reconnects with exponential backoff.
Returns a Reconnect handle; drop the last handle to stop the loop.
Sourcepub fn publish(self, origin: OriginConsumer) -> Option<Reconnect>
pub fn publish(self, origin: OriginConsumer) -> Option<Reconnect>
Dial the configured ClientConfig::connect URL, publishing origin to it
and reconnecting with backoff until the returned handle is dropped.
Returns None when no --client-connect URL was configured, so a caller
that may run server-only doesn’t have to branch on the URL itself.
Sourcepub fn consume(self, origin: OriginProducer) -> Option<Reconnect>
pub fn consume(self, origin: OriginProducer) -> Option<Reconnect>
Dial the configured ClientConfig::connect URL, consuming its broadcasts
into origin and reconnecting with backoff until the returned handle is
dropped.
Returns None when no --client-connect URL was configured.