Skip to content

Commit 01b1498

Browse files
kixelatedclaude
andcommitted
Revert accidental commit 24d2560 (moq-native connect/reconnect refactor)
Commit 24d2560 was pushed to main by mistake: it captured an in-progress moq-native Client::connect / reconnect refactor under an unrelated commit message ("classify malformed auth-API JSON ...") and bypassed review. This reverts those changes so the refactor can land properly via its own PR. The original change is preserved in history at 24d2560 for re-use. This reverts commit 24d2560. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 319b619 commit 01b1498

20 files changed

Lines changed: 36 additions & 53 deletions

File tree

doc/lib/rs/env/native.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ Create a [`ClientConfig`](https://docs.rs/moq-native/latest/moq_native/struct.Cl
2323
```rust
2424
let client = moq_native::ClientConfig::default().init()?;
2525
let url = url::Url::parse("https://cdn.moq.dev/anon/my-broadcast")?;
26-
let session = client.connect_once(url).await?;
26+
let session = client.connect(url).await?;
2727
```
2828

2929
The default configuration uses system TLS roots, enables WebSocket fallback, and gives QUIC a 200ms head-start.
3030

31-
`connect_once` makes a single attempt and resolves to a session. For most apps prefer `client.connect(url)`, which stays connected and reconnects with exponential backoff whenever the session drops, returning a [`Reconnect`](https://docs.rs/moq-native/latest/moq_native/struct.Reconnect.html) handle.
32-
3331
### URL Schemes
3432

3533
The client supports several URL schemes:
@@ -41,7 +39,7 @@ The client supports several URL schemes:
4139

4240
### Transport Racing
4341

44-
`client.connect()` and `client.connect_once()` automatically race QUIC and WebSocket connections.
42+
`client.connect()` automatically races QUIC and WebSocket connections.
4543
QUIC gets a configurable head-start (default 200ms); if it fails, WebSocket takes over.
4644
Once WebSocket wins for a given server, future connections skip the delay.
4745
This is transparent to your application.
@@ -54,7 +52,7 @@ Pass JWT tokens via URL query parameters:
5452
let url = Url::parse(&format!(
5553
"https://relay.example.com/room/123?jwt={}", token
5654
))?;
57-
let session = client.connect_once(url).await?;
55+
let session = client.connect(url).await?;
5856
```
5957

6058
See the [Authentication guide](/bin/relay/auth) for how to generate tokens.

doc/lib/rs/index.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,20 +231,17 @@ a relay with a few lines:
231231
```rust
232232
let client = moq_native::ClientConfig::default().init()?;
233233
let url = url::Url::parse("https://relay.moq.dev/anon")?;
234-
let session = client.connect_once(url).await?;
234+
let session = client.connect(url).await?;
235235
```
236236

237-
`connect_once` makes a single attempt; `client.connect(url)` instead stays connected
238-
and reconnects with exponential backoff whenever the session drops.
239-
240237
To publish or consume, wire an [`Origin`](https://docs.rs/moq-net/latest/moq_net/struct.Origin.html)
241238
into the session before connecting:
242239

243240
```rust
244241
// Subscribe: wait for broadcasts to be announced.
245242
let origin = moq_net::Origin::new().produce();
246243
let mut consumer = origin.consume();
247-
let session = client.with_consume(origin).connect_once(url).await?;
244+
let session = client.with_consume(origin).connect(url).await?;
248245

249246
while let Some((path, broadcast)) = consumer.announced().await {
250247
// ... subscribe to tracks on each broadcast ...

rs/hang/examples/subscribe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async fn run_session(origin: moq_net::OriginProducer) -> anyhow::Result<()> {
3131
// Establish a connection with automatic reconnection.
3232
// with_consume() registers an OriginProducer for incoming data.
3333
// Use with_publish() if you also want to publish from the session.
34-
let reconnect = client.with_consume(origin).connect(url);
34+
let reconnect = client.with_consume(origin).reconnect(url);
3535

3636
// Wait until the reconnect loop stops (e.g. timeout exceeded).
3737
Ok(reconnect.closed().await?)

rs/hang/examples/video.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async fn run_session(origin: moq_net::OriginConsumer) -> anyhow::Result<()> {
3131
// Establish a connection with automatic reconnection.
3232
// with_publish() registers an OriginConsumer for outgoing data.
3333
// Use with_consume() if you also want to subscribe/consume from the session.
34-
let reconnect = client.with_publish(origin).connect(url);
34+
let reconnect = client.with_publish(origin).reconnect(url);
3535

3636
// Wait until the reconnect loop stops (e.g. timeout exceeded).
3737
Ok(reconnect.closed().await?)

rs/libmoq/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl Session {
7272
.init()?
7373
.with_publish(publish)
7474
.with_consume(consume)
75-
.connect(url);
75+
.reconnect(url);
7676

7777
// report() runs until the reconnect loop gives up; map its terminal error to Connect.
7878
Self::report(callback, reconnect)

rs/moq-boy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ async fn run(config: &Config) -> Result<()> {
235235
let reconnect = client
236236
.with_publish(publish_origin.consume())
237237
.with_consume(consume_origin)
238-
.connect(config.url.clone());
238+
.reconnect(config.url.clone());
239239

240240
// Set up catalog and encoders.
241241
let catalog = moq_mux::catalog::hang::Producer::new(&mut broadcast)?;

rs/moq-cli/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub async fn run_client(client: moq_native::Client, url: Url, name: String, publ
1010

1111
tracing::info!(%url, %name, "connecting");
1212

13-
let reconnect = client.with_publish(origin.consume()).connect(url);
13+
let reconnect = client.with_publish(origin.consume()).reconnect(url);
1414

1515
#[cfg(unix)]
1616
// Notify systemd that we're ready.

rs/moq-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ async fn run_subscribe(
223223

224224
tracing::info!(%url, %broadcast, "connecting");
225225

226-
let reconnect = client.with_consume(origin).connect(url);
226+
let reconnect = client.with_consume(origin).reconnect(url);
227227

228228
#[cfg(unix)]
229229
let _ = sd_notify::notify(&[sd_notify::NotifyState::Ready]);

rs/moq-ffi/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Client {
2727
let session = client
2828
.with_publish(publish)
2929
.with_consume(consume)
30-
.connect_once(url)
30+
.connect(url)
3131
.await
3232
.map_err(|err| MoqError::Connect(format!("{err}")))?;
3333

rs/moq-gst/src/sink/imp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ async fn run_session(
402402
);
403403

404404
let client = client.with_publish(origin.consume());
405-
let session = client.connect_once(settings.url.clone()).await?;
405+
let session = client.connect(settings.url.clone()).await?;
406406

407407
let mut runtime = RuntimeState {
408408
session,

0 commit comments

Comments
 (0)