Skip to main content

accept

Function accept 

Source
pub async fn accept(
    server: &Server,
    subscriber: &Consumer,
    broadcast: impl AsPath,
    offer: &str,
) -> Result<Response>
Expand description

Accept a WHEP SDP offer and egress the MoQ broadcast broadcast (a path relative to subscriber’s root) to the negotiated WebRTC peer.

This is the negotiation core behind router, exposed so an embedder can own the HTTP route and authentication: verify the request, resolve the authorized broadcast name, scope subscriber to the caller’s grants, then hand the raw SDP offer here. Taking the consumer explicitly (rather than using the server’s) lets the embedder egress through a scoped origin, so the subscribe scope is enforced by moq-net exactly as for a native session; the bundled router passes the server’s own (unauthenticated) consumer. It parses the offer, resolves the broadcast on subscriber, restricts the answer to the codecs the catalog actually has, registers a media session on the shared mux, and returns the SDP answer plus an opaque resource_id for the WHEP Location header. The caller must run the returned Response to drive the MoQ->RTP session. Mirrors whip::accept.

offer is the raw SDP body; the caller is responsible for checking the Content-Type: application/sdp request header. Fails with Error::InvalidSdp on a malformed offer, and surfaces a not-announced broadcast (or one outside subscriber’s scope) as Error::Other.