| Crates.io | moq-lite |
| lib.rs | moq-lite |
| version | 0.7.1 |
| created_at | 2025-03-23 19:15:44.36672+00 |
| updated_at | 2025-09-22 21:32:33.439742+00 |
| description | Media over QUIC - Transport (Lite) |
| homepage | |
| repository | https://github.com/kixelated/moq |
| max_upload_size | |
| id | 1602974 |
| size | 183,464 |
A Rust implementation of the Media over QUIC transport.
This crate provides the core networking layer, implementing the moq-lite specification. Live media is built on top of this layer using something like hang.
// Optional: Use moq_native to make a QUIC client.
let config = moq_native::ClientConfig::default(); // See documentation
let client = moq_native::Client::new(config);
// For local development, use: http://localhost:4443/anon
// The "anon" path is usually configured to bypass authentication; be careful!
let url = url::Url::parse("https://relay.moq.dev/anon").unwrap();
// Establish a WebTransport/QUIC connection.
let connection = client.connect(url).await?;
// Perform the MoQ handshake.
let mut session = moq_lite::Session::connect(connection).await?;
// Create a broadcast.
// A broadcast is a collection of tracks, but in this example there's just one.
let broadcast = moq_lite::BroadcastProducer::new();
// Create a track that we'll insert into the broadcast.
// A track is a series of groups representing a live stream.
let track = broadcast.create(moq_lite::Track {
name: "chat".to_string(),
priority: 0,
});
// Create a group.
// Each group is independent and the newest group(s) will be prioritized.
let group = track.append();
// Write frames to the group.
// Each frame is dependent on the previous frame, so older frames are prioritized.
group.append(b"Hello");
group.append(b"World");
// Finally, publish the broadcast to the session.
// You can provide a broadcast path which gets appended to the URL.
session.publish("my-broadcast", broadcast.consume());
// NOTE: You can create multiple consumer instances of any `XxxProducer`
// Each which will receive a (ref-counted) copy of the data.
let _broadcast = broadcast.consume();
let _track = track.consume();
let _group = group.consume();