pub struct Session { /* private fields */ }Expand description
A MoQ session, used to publish and/or subscribe to broadcasts.
A publisher will Self::publish tracks, or alternatively [Self::announce] and [Self::route] arbitrary paths. A subscriber will [Self::subscribe] to tracks, or alternatively use Self::announced to discover arbitrary paths.
Implementations§
Source§impl Session
impl Session
Sourcepub async fn connect<T: Into<Session>>(session: T) -> Result<Self, Error>
pub async fn connect<T: Into<Session>>(session: T) -> Result<Self, Error>
Perform the MoQ handshake as a client.
Sourcepub async fn accept<T: Into<Session>>(session: T) -> Result<Self, Error>
pub async fn accept<T: Into<Session>>(session: T) -> Result<Self, Error>
Perform the MoQ handshake as a server
Sourcepub fn publish<T: ToString>(&mut self, path: T, broadcast: BroadcastConsumer)
pub fn publish<T: ToString>(&mut self, path: T, broadcast: BroadcastConsumer)
Publish a broadcast, automatically announcing and serving it.
Sourcepub fn consume(&self, path: &str) -> BroadcastConsumer
pub fn consume(&self, path: &str) -> BroadcastConsumer
Scope subscriptions to a broadcast, returning a handle that can request tracks.
No data flows over the network until BroadcastConsumer::subscribe is called.
Sourcepub fn announced<S: ToString>(&self, prefix: S) -> AnnounceConsumer
pub fn announced<S: ToString>(&self, prefix: S) -> AnnounceConsumer
Discover any broadcasts published by the remote matching a prefix.
There will be an event each time a broadcast starts and later ends. The results contain the suffix only; you may need to re-apply the prefix.
Sourcepub async fn publish_to(&mut self, origin: Origin, prefix: &str)
pub async fn publish_to(&mut self, origin: Origin, prefix: &str)
Publish all of our broadcasts to the given origin.
If an optional prefix is provided, the prefix will be applied when inserting into the origin.
Sourcepub async fn consume_from(&mut self, origin: Origin, prefix: &str)
pub async fn consume_from(&mut self, origin: Origin, prefix: &str)
Serve all broadcasts from the given origin.
If the prefix is provided, then only broadcasts matching the (stripped) prefix are served.