pub struct Server { /* private fields */ }Expand description
A MoQ server session builder.
Implementations§
Source§impl Server
impl Server
pub fn new() -> Self
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 StatsHandle. Per-broadcast and per-subscription
counters will be bumped through this handle for the lifetime of the session.
Pass StatsHandle::default (a no-op handle) to opt out.
Sourcepub fn with_origin(self, origin: OriginProducer) -> Self
pub fn with_origin(self, origin: OriginProducer) -> Self
Set both publish and consume from an OriginProducer.
This is equivalent to calling with_publish(origin.consume()) and with_consume(origin).
pub fn with_versions(self, versions: Versions) -> Self
Sourcepub async fn accept<S: Session>(&self, session: S) -> Result<Session, Error>
pub async fn accept<S: Session>(&self, session: S) -> Result<Session, Error>
Perform the MoQ handshake as a server, returning the established Session.
Convenience wrapper over accept_request that completes
the handshake immediately. Use accept_request when you need to inspect the
client’s advertised path before deciding what to serve.
Sourcepub async fn accept_request<S: Session>(
&self,
session: S,
) -> Result<Request<S>, Error>
pub async fn accept_request<S: Session>( &self, session: S, ) -> Result<Request<S>, Error>
Begin the MoQ handshake, pausing once the client’s request path is known so the caller can authorize or scope before serving.
Reads the client’s SETUP (the in-band path lives there on URL-less transports),
then returns a Request: inspect path, set the origins to
serve, and call ok or close. Starting the
session is deferred to ok(), so origins set on the Request take effect.
The path is surfaced for moq-lite-05; it is None on versions with no in-band
request path (lite 01-04, and the IETF drafts in this build).