Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6894f63
chore(quest): claim quest/m1/ordered-owed-holes.md
kixelated Nov 3, 2026
c018da9
docs(net): record Ordered latest-read decision and stall evidence
kixelated Nov 3, 2026
d9e83e5
Merge origin/main into quest/m1/ordered-owed-holes
kixelated Nov 3, 2026
0e7489d
wip: snapshot consumers read at zero delay
kixelated Nov 3, 2026
0d34abf
quest: snapshot consumers always read at zero delay
kixelated Nov 3, 2026
1f8b2ee
feat(json)!: snapshot consumers always read at zero delay
kixelated Nov 3, 2026
7735d52
chore(dart): refresh the snapshot next() checksum
kixelated Nov 3, 2026
f4a4644
Merge origin/main into quest/m1/ordered-owed-holes
kixelated Nov 3, 2026
fa1154b
fix(json): hold snapshot consumers at zero delay across later updates
kixelated Nov 3, 2026
22266bd
test(json): park the reads with the clock's sleep
kixelated Nov 3, 2026
0909bb8
Merge remote-tracking branch 'origin/main' into t3/2b1af1b5
kixelated Nov 3, 2026
90d87ad
fix(json): keep the zero delay across coalesced and concurrent updates
kixelated Nov 3, 2026
2edaac8
fix(json): pin before each JS read as well
kixelated Nov 4, 2026
4e4f9d3
Merge origin/main into quest/m1/ordered-owed-holes
kixelated Nov 4, 2026
0a8afe4
Merge remote-tracking branch 'origin/main' into t3/e476df84
kixelated Nov 4, 2026
9b341ee
fix(net): pin a subscriber's max delay where every update applies
kixelated Nov 4, 2026
e7bccb6
test(net): type the pinned subscription the test expects
kixelated Nov 4, 2026
0bbb542
chore(net): record pinMaxDelay in the API report
kixelated Nov 4, 2026
053b201
fix(net): mirror a routed reader's preferences into its copies before…
kixelated Nov 4, 2026
acb5d1d
feat(json)!: snapshot consumers subscribe themselves at zero delay
kixelated Nov 4, 2026
b175944
fix: port remaining snapshot and catalog callers; regenerate Dart bin…
kixelated Nov 4, 2026
2bc377e
Merge remote-tracking branch 'origin/main' into iterate-7736
kixelated Nov 4, 2026
fef07d9
fix: box the snapshot reader; format Kotlin
kixelated Nov 4, 2026
7ee45dd
fix(mux): box both JSON readers
kixelated Nov 4, 2026
6b170a4
test(gst): a refused catalog surfaces from the catalog read
kixelated Nov 4, 2026
d5db3d2
fix(mux): a refused hang catalog still fails catalog::Consumer::new
kixelated Nov 4, 2026
9ff94dc
test(stats): wait for the held track's subscription before reading
kixelated Nov 4, 2026
e92330c
fix(json): a read in flight when the snapshot consumer closes ends cl…
kixelated Nov 4, 2026
5acfbc3
Merge remote-tracking branch 'origin/main' into iterate-7736
kixelated Nov 4, 2026
62e374e
Merge remote-tracking branch 'origin/main' into iterate-7736-r2
kixelated Nov 5, 2026
685638c
fix: snapshot priority through the FFI; serialize JS snapshot reads
kixelated Nov 5, 2026
4403633
fix: port main's new stats test to the self-subscribing consumer; clippy
kixelated Nov 5, 2026
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
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion dart/moq/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Use `BroadcastProducer.createDatagrams(name: ..., info: ...)` and `BroadcastCons

A null `TrackInfo.maxAge`, the default, and a null info now advertise a zero max age, serving only the live edge, instead of no publisher limit. Pass `maxAgeUnlimited: true`, which ignores `maxAge`, where you relied on null meaning no limit. A received track's `info()` sets it when its publisher advertised no limit.

### Snapshot consumers subscribe themselves at a zero delay ([#7736](https://github.com/moq-dev/moq/pull/7736))

`SnapshotConsumer(broadcast: ..., name: ..., priority: ...)` takes the `BroadcastConsumer` and the track name instead of `track:`, and subscribes to the track itself at a zero `delay.max` and `priority` (default 0). Drop the `subscribeTrack` call; a refused subscription now throws from the first read. `next()` skips every group a newer one supersedes, and `latest()` no longer waits for a lower group the track still owes. Publish a stream track when every state must survive, or a window track for a bounded recent history.

### Viewer targets are bounded ([#7090](https://github.com/moq-dev/moq/pull/7090))

Viewer ceilings and PROBE target overrides are refused with the new `OutOfRangeMoqException` once they would sum above 2^53 - 1 bps, the most a PROBE target carries; nothing changes on a refusal. `Viewers.watch` and `setTarget` and `Viewer.update` throw it. Handle the new variant wherever you match the error exhaustively. Regenerate bindings and rebuild the matching native library together.
Expand Down Expand Up @@ -56,7 +60,7 @@ A fixed audio playout delay `d` is `delay: Delay(min: d, max: ...)` with `estima

`package:moq/flate.dart` is removed: publish opaque bytes on a `TrackProducer`.
`SnapshotConfig` and `WindowConfig` lose `compression`, and `StreamConfig` is removed. Publish the track with `MoqTrackInfo(compress: true)` instead.
`StreamProducer` drops its `config`, and `SnapshotConsumer`, `StreamConsumer`, and `WindowConsumer` take only the track.
`StreamProducer` drops its `config`, and `StreamConsumer` and `WindowConsumer` take only the track. `SnapshotConsumer` takes the broadcast and track name; see the entry above.

### Paths with an empty segment are refused ([#6648](https://github.com/moq-dev/moq/pull/6648))

Expand Down
4 changes: 2 additions & 2 deletions dart/moq/lib/json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import 'package:moq_ffi/moq_ffi.dart';
/// Publishes lossy latest-value JSON snapshots on a track it takes over.
typedef SnapshotProducer = MoqJsonSnapshotProducer;

/// Consumes each JSON snapshot state from a track it takes over, or skips to
/// the newest with `latest()`.
/// Consumes each JSON snapshot state from a track it subscribes to itself, or
/// skips to the newest with `latest()`.
typedef SnapshotConsumer = MoqJsonSnapshotConsumer;

/// Configures a lossy latest-value JSON producer.
Expand Down
9 changes: 4 additions & 5 deletions dart/moq/test/moq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,10 @@ void main() {
),
config: moq_json.SnapshotConfig(),
);
final track = await broadcast
.consume()
.subscribeTrack(name: 'status', subscription: null)
.timeout(timeout);
final consumer = moq_json.SnapshotConsumer(track: track);
final consumer = moq_json.SnapshotConsumer(
broadcast: broadcast.consume(),
name: 'status',
);

for (var n = 1; n <= 4; n++) {
producer.update(
Expand Down
40 changes: 26 additions & 14 deletions dart/moq_ffi/lib/src/moq.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11596,14 +11596,19 @@ class MoqJsonSnapshotConsumer implements MoqJsonSnapshotConsumerInterface {
MoqJsonSnapshotConsumer._(this._ptr) {
_MoqJsonSnapshotConsumerFinalizer.attach(this, _ptr, detach: this);
}
MoqJsonSnapshotConsumer({required MoqTrackConsumer track})
: _ptr = rustCall(
(status) => uniffi_moq_ffi_fn_constructor_moqjsonsnapshotconsumer_new(
FfiConverterMoqTrackConsumer.lower(track),
status,
),
moqExceptionErrorHandler,
) {
MoqJsonSnapshotConsumer({
required MoqBroadcastConsumer broadcast,
required String name,
int priority = 0,
}) : _ptr = rustCall(
(status) => uniffi_moq_ffi_fn_constructor_moqjsonsnapshotconsumer_new(
FfiConverterMoqBroadcastConsumer.lower(broadcast),
FfiConverterString.lower(name),
FfiConverterInt8.lower(priority),
status,
),
moqExceptionErrorHandler,
) {
_MoqJsonSnapshotConsumerFinalizer.attach(this, _ptr, detach: this);
}
factory MoqJsonSnapshotConsumer.lift(Pointer<Void> ptr) {
Expand Down Expand Up @@ -20129,12 +20134,19 @@ external void uniffi_moq_ffi_fn_free_moqjsonsnapshotconsumer(
Pointer<RustCallStatus> uniffiStatus,
);

@Native<Pointer<Void> Function(Pointer<Void>, Pointer<RustCallStatus>)>(
assetId: _uniffiAssetId,
)
@Native<
Pointer<Void> Function(
Pointer<Void>,
RustBuffer,
Int8,
Pointer<RustCallStatus>,
)
>(assetId: _uniffiAssetId)
external Pointer<Void>
uniffi_moq_ffi_fn_constructor_moqjsonsnapshotconsumer_new(
Pointer<Void> track,
Pointer<Void> broadcast,
RustBuffer name,
int priority,
Pointer<RustCallStatus> uniffiStatus,
);

Expand Down Expand Up @@ -23586,7 +23598,7 @@ void _checkApiChecksums() {
60932) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_method_moqjsonsnapshotconsumer_next() != 5806) {
if (uniffi_moq_ffi_checksum_method_moqjsonsnapshotconsumer_next() != 15547) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_method_moqjsonsnapshotproducer_demand() !=
Expand Down Expand Up @@ -24092,7 +24104,7 @@ void _checkApiChecksums() {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_constructor_moqjsonsnapshotconsumer_new() !=
11929) {
47962) {
throw UniffiInternalError.panicked("UniFFI API checksum mismatch");
}
if (uniffi_moq_ffi_checksum_constructor_moqjsonsnapshotproducer_new() !=
Expand Down
4 changes: 2 additions & 2 deletions demo/carla/web/src/truck.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ describe("Truck safety controls", () => {
timestamps: [],
});
const front = new Json.Snapshot.Consumer<Record<string, unknown>>({
track: safety.broadcast.track("control").subscribe(),
track: safety.broadcast.track("control"),
});
const rear = new Json.Snapshot.Consumer<Record<string, unknown>>({
track: safety.broadcast.track("control").subscribe(),
track: safety.broadcast.track("control"),
});

try {
Expand Down
7 changes: 3 additions & 4 deletions demo/carla/web/src/truck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,12 @@ export class Truck {
this.#sawStatusSource = true;
this.statusState.set("pending");

const statusTrack = active.track("status").subscribe({ priority: 10 });
effect.cleanup(() => statusTrack.close());

const consumer = new Json.Snapshot.Consumer({
track: statusTrack,
track: active.track("status"),
schema: TruckStatusSchema,
priority: 10,
});
effect.cleanup(() => consumer.close());

effect.spawn(async () => {
for (;;) {
Expand Down
8 changes: 5 additions & 3 deletions demo/web/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,11 @@ ui.run((effect) => {
return;
}

const track = broadcast.track(trackName).subscribe({ priority: Hang.Catalog.PRIORITY.catalog });
effect.cleanup(() => track.close());
const consumer = new Json.Snapshot.Consumer<unknown>({ track });
const consumer = new Json.Snapshot.Consumer<unknown>({
track: broadcast.track(trackName),
priority: Hang.Catalog.PRIORITY.catalog,
});
effect.cleanup(() => consumer.close());

effect.spawn(async () => {
try {
Expand Down
5 changes: 2 additions & 3 deletions demo/web/src/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ function subscribeNode(effect: Signals.Effect, origin: Net.Origin.Reader, path:
const consumer = request.active.peek();
if (!consumer) return;

const track = consumer.track("group.json").subscribe();
effect.cleanup(() => track.close());
const group = new Json.Snapshot.Consumer<GroupFrame>({ track });
const group = new Json.Snapshot.Consumer<GroupFrame>({ track: consumer.track("group.json") });
effect.cleanup(() => group.close());
effect.spawn(async () => {
for (;;) {
const state = await effect.race(group.latest());
Expand Down
14 changes: 7 additions & 7 deletions doc/lib/js/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ are the catalog modes on the [hang](/concept/hang#data-tracks) page. Window is
a third framing for a raw track: both ends opt into it, and a generic catalog
reader will not pick it up.

- **Snapshot**: lossy latest value, with RFC 7396 merge-patch deltas. A delta before any snapshot is an error. `next()` yields every state in order; `latest()` skips to the newest. Deltas ride one group until a joiner wants a fresh one: give the track a `refresh` ratio (8 is typical) and the producer restates the value in a new group. Without a ratio a group rolls only at its caps.
- **Snapshot**: lossy latest value, with RFC 7396 merge-patch deltas. A delta before any snapshot is an error. `next()` yields each state in order, skipping every group a newer one supersedes; `latest()` skips to the newest. Deltas ride one group until a joiner wants a fresh one: give the track a `refresh` ratio (8 is typical) and the producer restates the value in a new group. Without a ratio a group rolls only at its caps.
- **Stream**: lossless append-log in a single group. A reader that falls behind fails the read rather than resuming mid-log.
- **Window**: a bounded run of records a reader can join at any point. A new group restates what it keeps explicitly, so a reader that was keeping up is not handed a record twice. Its ops roll on the track's `refresh` ratio the same way.

Expand All @@ -27,18 +27,18 @@ an untimed track (no `timescale`) takes none and reads back without one.
```ts
import { Snapshot } from "@moq/json";

// Hold each state back until the video playhead reaches it.
// Schedule each state at its capture time.
const consumer = new Snapshot.Consumer<Telemetry>({ track });
for await (const { value, at } of consumer) {
schedule(value, at);
}
```

`next()` buffers every state it has not yielded and skips a group once the
subscription's `delay.max` proves it stale. The budget counts media time and
wall time, or wall time alone for an untimed track. The default subscription's
zero keeps only the newest group, so subscribe with a `delay.max` covering how
far the playhead trails the live edge. Use `latest()` to skip straight to the head.
`next()` yields every buffered state of the group it is reading and skips a
group once a newer one supersedes it: the consumer takes the track, a
`Track.Consumer` such as `broadcast.track(name)`, and subscribes to it itself at
a zero `delay.max`, so nothing can raise its budget. Use `latest()` to skip
straight to the head, and `close()` to end the subscription.

A stream rides one group with no record-count or cumulative byte limit. The
group retains a 32 MiB tail; a reader that falls behind gets `Evicted` rather
Expand Down
8 changes: 3 additions & 5 deletions doc/lib/js/watch.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,11 @@ const dispose = el.signals.run((effect) => {
const name = metadata?.[0];
if (!active || !name) return;

const track = active.track(name).subscribe({
...Moq.Track.Subscription.default(),
const consumer = new Json.Snapshot.Consumer<unknown>({
track: active.track(name),
priority: Hang.Catalog.PRIORITY.catalog,
});
effect.cleanup(() => track.close());

const consumer = new Json.Snapshot.Consumer<unknown>({ track });
effect.cleanup(() => consumer.close());
effect.spawn(async () => {
for (;;) {
const state = await effect.race(consumer.latest());
Expand Down
9 changes: 5 additions & 4 deletions doc/lib/rs/moq-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ same optional capture time when opened, including when they publish on drop.

Consumers return `Timed<T>`: read `.value` for the decoded value and `.at` for
its optional frame timestamp, with the track's exact scale preserved. Snapshot
`next()` yields states in order inside the subscription's `delay.max` budget;
set that budget when following a playhead behind live. Use `latest()` to skip
to the newest buffered state. Skipped states are gone, and a later `next()`
continues after them.
`next()` yields states in order, skipping every group a newer one supersedes:
`snapshot::Consumer::new` takes the track and subscribes to it itself at a zero
`delay.max`, so nothing can raise its budget. Use `latest()` to skip to the
newest buffered state. Skipped states
are gone, and a later `next()` continues after them.

Upgrading from an older release: see moq-json's
[MIGRATE.md](https://github.com/moq-dev/moq/blob/main/rs/moq-json/MIGRATE.md).
Expand Down
6 changes: 5 additions & 1 deletion go/wrapper/MIGRATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Replace stream-track `AppendDatagram` / `InsertDatagram` / `RecvDatagram` with `

`TrackInfo.MaxAge` is a `time.Duration` instead of a `*time.Duration`, like `Delay.Max`: the zero value, and a nil `*TrackInfo`, now advertise a zero max age, serving only the live edge, instead of no publisher limit. Assign the duration directly, and set the new `MaxAgeUnlimited`, which ignores `MaxAge`, where you relied on nil meaning no limit. A received track's `Info()` sets it when its publisher advertised no limit.

### Snapshot consumers subscribe themselves at a zero delay ([#7736](https://github.com/moq-dev/moq/pull/7736))

`json.NewSnapshotConsumer(broadcast, name, options)` takes the `*BroadcastConsumer`, the track name, and `SnapshotConsumerOptions` instead of a `*TrackConsumer`, and subscribes to the track itself at a zero `Delay.Max` and the options' `Priority`. Drop the `SubscribeTrack` call; a refused subscription now fails the first read. `Next` skips every group a newer one supersedes, and `Latest` no longer waits for a lower group the track still owes. Publish a stream track when every state must survive, or a window track for a bounded recent history.

### Viewer targets are bounded ([#7090](https://github.com/moq-dev/moq/pull/7090))

Viewer ceilings and PROBE target overrides are refused with the new `ErrOutOfRange` once they would sum above 2^53 - 1 bps, the most a PROBE target carries; nothing changes on a refusal. `Viewers.Watch` returns `(*Viewer, error)`, and `Viewers.SetTarget` and `Viewer.Update` return an `error`. Handle the new variant wherever you match the error exhaustively. Regenerate bindings and rebuild the matching native library together.
Expand Down Expand Up @@ -195,7 +199,7 @@ Application calls are unchanged.
### JSON consumers return `*json.Timed` (#5677)

`SnapshotConsumer.Next`, `StreamConsumer.Next`, and `All` return `*Timed{Value, Timestamp}` instead of the raw message; `Timestamp` is a `*time.Duration`, nil when untimed.
A snapshot consumer's `Next` now yields every state in order; call `Latest(ctx)` for the newest.
A snapshot consumer's `Next` now yields each state in order, skipping every group a newer one supersedes (see the zero-delay entry above); call `Latest(ctx)` for the newest.
Timestamps are rounded down to a whole microsecond.

### Ranges filter reads (#5929)
Expand Down
8 changes: 5 additions & 3 deletions go/wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ so the media importer selects the timescale.
JSON tracks live in the `moq.dev/moq/json` subpackage, mirroring the `moq-json` crate.
Import it under an alias next to `encoding/json`. Each type wraps a track:
`NewSnapshotProducer` / `NewStreamProducer` take over a `TrackProducer` and advertise it
in the broadcast's catalog, and `NewSnapshotConsumer` / `NewStreamConsumer` take over a
`TrackConsumer` that has not read a group yet. Snapshots carry lossy latest state; streams
in the broadcast's catalog, `NewStreamConsumer` takes over a `TrackConsumer` that has not
read a group yet, and `NewSnapshotConsumer` takes the `BroadcastConsumer` and track name and
subscribes itself at a zero `Delay.Max` and `SnapshotConsumerOptions.Priority`. Snapshots carry lossy latest state; streams
carry every record in order. `NewWindowProducer` / `NewWindowConsumer` carry a sliding window
of records a reader can join at any point; the catalog has no window mode, so the producer
takes only the track. Producers accept any `encoding/json` value; consumers return
Expand Down Expand Up @@ -148,7 +149,8 @@ _ = publication.Announce(moq.AnnounceRoute{})
```

Snapshot and window producers take `SnapshotOptions` or `WindowOptions`; the stream producer and
every consumer take only the track, and a consumer reads a compressed track like a plain one.
the stream and window consumers take only the track. Every consumer reads a compressed track like a
plain one.

## Errors

Expand Down
21 changes: 14 additions & 7 deletions go/wrapper/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,26 @@ type SnapshotConsumer struct {
inner *ffi.MoqJsonSnapshotConsumer
}

// NewSnapshotConsumer reads track as a lossy latest-value JSON track. It takes over
// track, whose handle is closed afterward, and fails if track has already read a group.
func NewSnapshotConsumer(track *moq.TrackConsumer) (*SnapshotConsumer, error) {
inner, err := ffi.NewMoqJsonSnapshotConsumer(bridge.TrackConsumer(track))
// SnapshotConsumerOptions configures a snapshot consumer's subscription.
type SnapshotConsumerOptions struct {
// Priority is the subscription's delivery priority, higher first, as
// moq.Subscription.Priority.
Priority int8
}

// NewSnapshotConsumer subscribes to the track named name on broadcast and reads it as a
// lossy latest-value JSON track. The consumer owns its subscription, at a zero Delay.Max
// and the options' priority; a read waits for it to resolve and fails if it cannot.
func NewSnapshotConsumer(broadcast *moq.BroadcastConsumer, name string, options SnapshotConsumerOptions) (*SnapshotConsumer, error) {
inner, err := ffi.NewMoqJsonSnapshotConsumer(bridge.BroadcastConsumer(broadcast), name, options.Priority)
if err != nil {
return nil, err
}
return &SnapshotConsumer{inner: inner}, nil
}

// Next returns the next state in order, or nil when the track ends. Groups older
// than the subscription's Delay.Max are skipped, so a playhead reader sets that
// budget to its distance behind live.
// Next returns the next state in order, or nil when the track ends. It skips
// every group a newer one supersedes.
func (c *SnapshotConsumer) Next(ctx context.Context) (*Timed, error) {
value, err := bridge.Call(ctx, c.inner.Cancel, c.inner.Next)
return timed(value), err
Expand Down
4 changes: 2 additions & 2 deletions go/wrapper/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestTracks(t *testing.T) {
if err != nil {
t.Fatal(err)
}
snapshotConsumer, err := moqjson.NewSnapshotConsumer(subscribeTrack(ctx, t, consumer, "status"))
snapshotConsumer, err := moqjson.NewSnapshotConsumer(consumer, "status", moqjson.SnapshotConsumerOptions{})
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestDemand(t *testing.T) {
t.Fatalf("Wanted = %d before any subscriber", *wanted)
}

snapshotConsumer, err := moqjson.NewSnapshotConsumer(subscribeTrack(ctx, t, consumer, "status"))
snapshotConsumer, err := moqjson.NewSnapshotConsumer(consumer, "status", moqjson.SnapshotConsumerOptions{})
if err != nil {
t.Fatal(err)
}
Expand Down
11 changes: 7 additions & 4 deletions js/hang/src/catalog/root.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Json from "@moq/json";
import type * as Moq from "@moq/net";
import { Path, Track } from "@moq/net";
import { Path } from "@moq/net";
import * as z from "zod/mini";
import { AudioSchema } from "./audio";
import { BinarySchema } from "./binary";
Expand Down Expand Up @@ -191,15 +191,18 @@ export function checkResolvable(root: Root, base: Moq.Path.Valid): Root {
* yielded unresolved.
*/
export async function* watch(broadcast: Moq.Broadcast.Consumer): AsyncIterable<Root> {
const track = broadcast.track(TRACK).subscribe({ ...Track.Subscription.default(), priority: PRIORITY.catalog });
const consumer = new Json.Snapshot.Consumer<Root>({
track: broadcast.track(TRACK),
schema: RootSchema,
priority: PRIORITY.catalog,
});
try {
const consumer = new Json.Snapshot.Consumer<Root>({ track, schema: RootSchema });
for (;;) {
const root = await consumer.latest();
if (!root) return;
yield checkResolvable(checkRenditions(root.value), broadcast.path);
}
} finally {
track.close();
consumer.close();
}
}
Loading
Loading