Expand description
An fork of the MoQ Transport protocol.
MoQ Transfork is a pub/sub protocol over QUIC. While originally designed for live media, MoQ Transfork is generic and can be used for other live applications. The specification is a work in progress and will change. See the specification and github for any updates.
The core of this crate is Session, established with Session::connect (client) or Session::accept (server). Once you have a session, you can Session::publish or [Session::subscribe].
§Producing
There can be only 1 publisher.
- BroadcastProducer can create any number of TrackProducers. Each Track is produced independently with a specified order/priority.
- TrackProducer can append any number of GroupProducers, with new subscribers joining at Group boundaries (ex. keyframes).
- GroupProducer can append any number of Frames, either using GroupProducer::write_frame (contiguous) or GroupProducer::create_frame (chunked).
- FrameProducer is thus optional, allowing you to specify an upfront size to write multiple chunks.
All methods are synchronous and will NOT block. If there are no subscribers, then no data will flow over the network but it will remain in cache. If the session is dropped, then any future writes will error.
§Consuming
There can be N consumers (via Clone), each getting a copy of any requested data.
- BroadcastConsumer can fetch any number of TrackConsumers. Each Track is consumed independently with a specified order/priority.
- TrackConsumer can fetch any number of GroupConsumers, joining at a Group boundary (ex. keyframes).
- GroupConsumer can fetch any number of Frames, either using GroupConsumer::read_frame (contiguous) or GroupConsumer::next_frame (chunked).
- FrameConsumer is thus optional, allowing you to read chunks as they arrive.
All methods are asynchronous and will block until data is available. If the publisher disconnects, then the consumer will error. If the publisher is dropped (clean FIN), then the above methods will return None.
Re-exports§
pub use web_transport;
Modules§
- coding
- This module contains encoding and decoding helpers.
- message
- Low-level message sent over the wire, as defined in the specification.
Structs§
- Broadcast
Consumer - Subscribe to abitrary broadcast/tracks.
- Broadcast
Producer - Receive broadcast/track requests and return if we can fulfill them.
- Frame
- Frame
Consumer - Used to consume a frame’s worth of data in chunks.
- Frame
Producer - Used to write a frame’s worth of data in chunks.
- Group
- Group
Consumer - Consume a group, frame-by-frame.
- Group
Producer - Create a group, frame-by-frame.
- Origin
Consumer - Consumes announced broadcasts matching against an optional prefix.
- Origin
Producer - Announces broadcasts to consumers over the network.
- Session
- A MoQ session, used to publish and/or subscribe to broadcasts.
- Track
- Track
Consumer - A consumer for a track, used to read groups.
- Track
Producer - A producer for a track, used to create new groups.
Enums§
- Error
- A list of possible errors that can occur during the session.
Constants§
- ALPN
- The ALPN used when connecting via QUIC directly.