moq_transfork/lib.rs
1//! An fork of the MoQ Transport protocol.
2//!
3//! MoQ Transfork is a pub/sub protocol over QUIC.
4//! While originally designed for live media, MoQ Transfork is generic and can be used for other live applications.
5//! The specification is a work in progress and will change.
6//! See the [specification](https://datatracker.ietf.org/doc/draft-lcurley-moq-transfork/) and [github](https://github.com/kixelated/moq-drafts) for any updates.
7//!
8//! The core of this crate is [Session], established with [Session::connect] (client) or [Session::accept] (server).
9//! Once you have a session, you can [Session::publish] or [Session::subscribe].
10//!
11//! # Producing
12//! There can be only 1 publisher.
13//!
14//! - [BroadcastProducer] can create any number of [TrackProducer]s. Each [Track] is produced independently with a specified order/priority.
15//! - [TrackProducer] can append any number of [GroupProducer]s, with new subscribers joining at [Group] boundaries (ex. keyframes).
16//! - [GroupProducer] can append any number of [Frame]s, either using [GroupProducer::write_frame] (contiguous) or [GroupProducer::create_frame] (chunked).
17//! - [FrameProducer] is thus optional, allowing you to specify an upfront size to write multiple chunks.
18//!
19//! All methods are synchronous and will NOT block.
20//! If there are no subscribers, then no data will flow over the network but it will remain in cache.
21//! If the session is dropped, then any future writes will error.
22//!
23//! # Consuming
24//! There can be N consumers (via [Clone]), each getting a copy of any requested data.
25//!
26//! - [BroadcastConsumer] can fetch any number of [TrackConsumer]s. Each [Track] is consumed independently with a specified order/priority.
27//! - [TrackConsumer] can fetch any number of [GroupConsumer]s, joining at a [Group] boundary (ex. keyframes).
28//! - [GroupConsumer] can fetch any number of [Frame]s, either using [GroupConsumer::read_frame] (contiguous) or [GroupConsumer::next_frame] (chunked).
29//! - [FrameConsumer] is thus optional, allowing you to read chunks as they arrive.
30//!
31//! All methods are asynchronous and will block until data is available.
32//! If the publisher disconnects, then the consumer will error.
33//! If the publisher is dropped (clean FIN), then the above methods will return [None].
34//!
35mod error;
36mod model;
37mod session;
38
39pub mod coding;
40pub mod message;
41pub use error::*;
42pub use model::*;
43pub use session::*;
44
45/// The ALPN used when connecting via QUIC directly.
46pub const ALPN: &[u8] = b"moqf-02";
47
48/// Export the web_transport crate.
49pub use web_transport;