pub struct Server { /* private fields */ }Expand description
Glue that owns the moq-net origin pair and hands axum routers to the caller.
publisher is where server publish (WHIP) writes ingested broadcasts;
subscriber is what server subscribe (WHEP) reads from. They’re
typically the two halves of the same upstream moq_net::Session.
Implementations§
Source§impl Server
impl Server
Sourcepub fn new(config: Config, publisher: Producer, subscriber: Consumer) -> Self
pub fn new(config: Config, publisher: Producer, subscriber: Consumer) -> Self
Build a server. publisher receives WHIP broadcasts; subscriber
is the source for WHEP egress.
Sourcepub fn publish_router(&self) -> Router
pub fn publish_router(&self) -> Router
Router for server publish (WHIP). Mount under whichever HTTP path
the deployment prefers (/whip, /, …).
The router derives the broadcast name from the request path and performs
no authentication. To own the route and authorize requests yourself
(resolving the broadcast name from a verified token), skip the router and
call whip::accept directly from your own handler.
Sourcepub fn subscribe_router(&self) -> Router
pub fn subscribe_router(&self) -> Router
Router for server subscribe (WHEP). Mount under whichever HTTP path
the deployment prefers (/whep, /, …).
The router derives the broadcast name from the request path and performs
no authentication. To own the route and authorize requests yourself
(resolving the broadcast name from a verified token), skip the router and
call whep::accept directly from your own handler.
Sourcepub fn terminate(&self, resource_id: &str) -> bool
pub fn terminate(&self, resource_id: &str) -> bool
Terminate a negotiated session by its resource id (the Location path
component from the WHIP/WHEP response). Returns true if a live session
was found and signalled to stop; the session task then releases its
broadcast announcement and mux registration. Embedders that own their own
HTTP routing call this to honor a WHIP/WHEP DELETE; the bundled routers
already wire it to the DELETE method.