Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1041,12 +1041,3 @@ OOM kill does too, even inside a Quest scope: each worker watches `local.py`
through a pidfd and stops once it exits. macOS has no pidfd, so there killing
`local.py` with SIGKILL frees the lock while its workers keep measuring until
their own gates exit, an accepted gap. Stop it with Ctrl-C or SIGTERM instead.

### Python socket sessions

The Python binding runner also sweeps both TCP and track sockets over 1, 4,
and 16 accepting endpoints and 1, 4, and 16 concurrent sessions per endpoint.
Each session sends a checked payload and finishes both halves. The
`socket/<protocol>/endpoints=N/sessions=M` entries report complete sessions per
second, including handshake, FFI calls, reads, and teardown. Run with
`just py bench`; Nightly's binding lane runs the same sweep.
18 changes: 0 additions & 18 deletions dart/moq/lib/socket.dart

This file was deleted.

1 change: 0 additions & 1 deletion doc/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export default defineConfig({
{ text: "Transport", link: "/concept/transport" },
{ text: "moq-lite", link: "/concept/moq-lite" },
{ text: "Identity and recovery", link: "/concept/identity" },
{ text: "Sockets", link: "/concept/socket" },
{ text: "hang", link: "/concept/hang" },
{ text: "Archives", link: "/concept/archives" },
{ text: "Audio jitter", link: "/concept/audio-jitter" },
Expand Down
1 change: 0 additions & 1 deletion doc/concept/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ watched at 100 ms by one viewer and 10 s by another.
- [Transport](/concept/transport): why QUIC, and the WebTransport, WebSocket, and raw QUIC paths onto it.
- [moq-lite](/concept/moq-lite): the pub/sub protocol, discovery, path patterns, subscriptions, and congestion behavior.
- [Identity and recovery](/concept/identity): choosing stream instances, following restarts, and answering work on demand without mixing streams.
- [Sockets](/concept/socket): dial and accept point-to-point sessions through relays, each a track of messages each way.
- [hang](/concept/hang): the media catalog, containers, and how to extend both.
- [Archives](/concept/archives): record listed tracks into object storage and serve them back from a host.
- [Audio jitter](/concept/audio-jitter): how a receiver sizes its audio playout target from arrival timing.
Expand Down
225 changes: 0 additions & 225 deletions doc/concept/socket.md

This file was deleted.

41 changes: 0 additions & 41 deletions doc/lib/js/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,44 +95,3 @@ frame.finish();
const reader = await consumer.nextFrame();
for (let chunk = await reader?.readChunk(); chunk; chunk = await reader?.readChunk()) save(chunk);
```

## Sockets

Use `Moq.Socket.Endpoint` for [point-to-point sessions](/concept/socket), with the same
origin publishing and consuming through the relay. An endpoint's first dial announces its
hidden client broadcast and its first accept its hidden server broadcast, so grants decide
which roles it may take; accepting verifies that the named peer actually dialed this session.
Every hop needs moq-lite-07 or moq-transport. Lite-07 currently requires explicitly
offering `moq-lite-07-wip`; older moq-lite hops do not carry these hidden endpoints. While
the endpoint's own client connection is moq-lite before 07, its dials and accepts fail as
unsupported instead of waiting. A dialer can't tell a peer behind such a hop from one not
online yet, so its dial waits as for any absent peer.

```ts
const connection = await Moq.Connection.connect({
url, versions: ["moq-lite-07-wip"],
publish: origin.consume(), consume: origin,
});
const endpoint = new Moq.Socket.Endpoint(origin, Moq.Path.from("game"), "viewer");
const session = await endpoint.dialTrack("server", undefined, { signal: abort.signal });
// A socket session is scale-less, so a message's frame carries its group's key, here the first.
session.producer.writeFrame({ payload: new TextEncoder().encode("hello"), timestamp: Moq.Time.Timestamp.unscaled(0n) });
session.producer.finish(); // Ends this direction; the peer may still reply.
const reader = session.consumer.ordered();
for (let frame = await reader.readFrame(); frame; frame = await reader.readFrame()) {
receive(frame.payload);
}
endpoint.close();
connection.close();
```

A server takes `await endpoint.acceptTrack()`, then accepts or rejects that incoming dial.
The incoming peer and session are unverified claims; `accept()` can fail if the original
dial has closed. A pending dial waits for acceptance until it is cancelled or the endpoint
or session closes, with no acceptance timeout.
The stream exposes a track producer, where each group is one message, and an already
subscribed consumer in ascending order until updated, plus `peer` and `session`. It skips
groups that never arrive whole, including refused, dropped, or evicted groups; a cut group
is never a complete message. Finishing a producer ends that direction; aborting it or
closing the endpoint resets the session. Close endpoints explicitly, and use `AbortSignal`
to cancel pending dials and accepts. Keep session ids secret.
36 changes: 0 additions & 36 deletions doc/lib/py/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,39 +157,3 @@ A catalog that needs a newer moq-hang draft than this build reads raises `Error.
- API source: [py/moq-rs/moq](https://github.com/moq-dev/moq/tree/main/py/moq-rs/moq)
- Source and examples: [`py/moq-rs`](https://github.com/moq-dev/moq/tree/main/py/moq-rs)
- Raw bindings: [`moq-ffi`](https://pypi.org/project/moq-ffi/) on PyPI, for the unwrapped API

## Socket sessions

`moq.socket` connects endpoints through relays in either direction. Wire one
origin to both session directions, then hold an endpoint while its sessions run:

```python
import asyncio, moq

async def socket_client():
origin = moq.OriginProducer()
versions = ["moq-lite-07-wip"]
async with moq.Client("https://cdn.moq.dev/anon", versions=versions, publish=origin, consume=origin):
async with moq.socket.Endpoint(origin, "room", "client") as endpoint:
stream = await endpoint.dial_track("server")
stream.producer.write_frame(b"command", moq.Timestamp.unscaled(0)) # One message, the first group: key 0.
stream.producer.finish() # abort(error_code) ends it with an error instead.
async for group in stream.consumer:
async for frame in group:
print(frame.payload)

asyncio.run(socket_client())
```

Sockets need lite-07 or moq-transport on every hop, so the example opts into
`moq-lite-07-wip`. No client offers it by default while its wire format is a
work in progress, and the relay must accept it too.

A server awaits `endpoint.accept_track()`, then calls `await incoming.accept()`
or `incoming.reject()`. Accepting verifies that the claimed peer really dialed.
`TrackStream` exposes a track producer and a reliably subscribed, ascending
consumer, plus `peer` and `session`; each message is a group. Keep the session
id private. Omitted `info` keeps messages without a publisher age limit; update
the consumer's subscription to change delivery. Cancelling a dial or acceptance resets that dial;
closing the endpoint resets all its sessions. See [Sockets](/concept/socket)
for routing and authorization.
Loading