@moq/net 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/error.d.ts +62 -0
- package/error.d.ts.map +1 -0
- package/error.js +92 -0
- package/error.js.map +1 -0
- package/{util/error.test.d.ts.map → error.test.d.ts.map} +1 -1
- package/error.test.js +89 -0
- package/error.test.js.map +1 -0
- package/ietf/publisher.d.ts.map +1 -1
- package/ietf/publisher.js +1 -1
- package/ietf/publisher.js.map +1 -1
- package/ietf/subscriber.d.ts.map +1 -1
- package/ietf/subscriber.js +1 -1
- package/ietf/subscriber.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/integration.test.js +36 -0
- package/integration.test.js.map +1 -1
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +1 -1
- package/lite/publisher.js.map +1 -1
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +1 -1
- package/lite/subscriber.js.map +1 -1
- package/package.json +2 -2
- package/stream.d.ts.map +1 -1
- package/stream.js +25 -4
- package/stream.js.map +1 -1
- package/stream.test.js +32 -0
- package/stream.test.js.map +1 -1
- package/util/error.d.ts +0 -12
- package/util/error.d.ts.map +0 -1
- package/util/error.js +0 -30
- package/util/error.js.map +0 -1
- package/util/error.test.js +0 -45
- package/util/error.test.js.map +0 -1
- package/util/index.d.ts +0 -3
- package/util/index.d.ts.map +0 -1
- package/util/index.js +0 -4
- package/util/index.js.map +0 -1
- /package/{util/error.test.d.ts → error.test.d.ts} +0 -0
package/lite/publisher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../src/lite/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAe,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AM,KAAK,GAAG,aAAa,GAAG,cAAc,CAAC;oBAC7C,MAAM,SAAS,GAAG,CAAC,eAAe,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;oBAClE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG,eAAe,CAAC;oBACrE,UAAU,GAAG,MAAM,IAAI,SAAS,CAAC;gBAClC,CAAC;gBAED,IAAI,UAAU,EAAE,CAAC;oBAChB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC7D,eAAe,GAAG,OAAO,CAAC;oBAC1B,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;gBAClC,CAAC;YACF,CAAC;QACF,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;YACxC,MAAM,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;IACF,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;YACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;gBACpD,SAAS,CAAC,KAAK,EAAE,CAAC;YACnB,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,qEAAqE;QACrE,IAAI,CAAC,eAAe,EAAE,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IAClC,CAAC;CACD","sourcesContent":["import { type Dispose, Signal } from \"@moq/signals\";\nimport type * as broadcast from \"../broadcast.ts\";\nimport type * as group from \"../group.ts\";\nimport * as Path from \"../path.ts\";\nimport { type Stream, Writer } from \"../stream.ts\";\nimport { Timescale } from \"../time.ts\";\nimport type * as track from \"../track.ts\";\nimport { error, reason } from \"../util/error.ts\";\nimport { AnnounceInit, AnnounceOk, type AnnounceRequest, encodeAnnounceBroadcast } from \"./announce.ts\";\nimport { Datagram as DatagramMessage } from \"./datagram.ts\";\nimport * as DatagramStream from \"./datagram_stream.ts\";\nimport type { Fetch } from \"./fetch.ts\";\nimport { Group as GroupMessage } from \"./group.ts\";\nimport type { Origin } from \"./origin.ts\";\nimport { Probe } from \"./probe.ts\";\nimport {\n\tencodeSubscribeResponse,\n\ttype Subscribe,\n\tSubscribeEnd,\n\tSubscribeOk,\n\tSubscribeStart,\n\tSubscribeUpdate,\n} from \"./subscribe.ts\";\nimport { TrackInfo as TrackInfoMessage, type Track as TrackMessage } from \"./track.ts\";\nimport { hasAnnounceId, hasAnnounceOk, hasDatagrams, Version } from \"./version.ts\";\n\nconst PROBE_INTERVAL = 100; // ms\nconst PROBE_MAX_AGE = 10_000; // ms\nconst PROBE_MAX_DELTA = 0.25;\n\n/** Map a signed delta to an unsigned zigzag varint value (mirrors Rust `VarInt::from_zigzag`). */\nfunction zigzag(delta: bigint): bigint {\n\treturn delta >= 0n ? delta << 1n : (-delta << 1n) - 1n;\n}\n\n// The TRACK stream, implicit SUBSCRIBE acceptance, and SUBSCRIBE_START/END are\n// all lite-05+.\nfunction supportsTrackStream(version: Version): boolean {\n\tswitch (version) {\n\t\tcase Version.DRAFT_01:\n\t\tcase Version.DRAFT_02:\n\t\tcase Version.DRAFT_03:\n\t\tcase Version.DRAFT_04:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n\n/**\n * Handles publishing broadcasts and managing their lifecycle.\n *\n * @internal\n */\nexport class Publisher {\n\t// The version of the connection.\n\treadonly version: Version;\n\n\t// Per-connection origin appended to outbound Announce hops, so the peer\n\t// can detect loops and prefer shorter paths. Created by Connection and\n\t// shared with Subscriber, which can optionally use it to filter out its\n\t// own announcements.\n\treadonly origin: Origin;\n\n\t#quic: WebTransport;\n\n\t// The one writer for the outbound datagram stream (getWriter locks it), acquired once at\n\t// construction when this version + transport carry datagrams, released in close(). Its\n\t// presence is the gate: undefined means datagrams aren't served on this connection. All\n\t// subscriptions share it, since a second getWriter on the same stream would throw.\n\t#datagramWriter?: WritableStreamDefaultWriter<Uint8Array>;\n\n\t// Our published broadcasts.\n\t// It's a signal so we can live update any announce streams.\n\t#broadcasts = new Signal<Map<Path.Valid, broadcast.Producer> | undefined>(new Map());\n\n\t// TRACK_INFO is immutable per track, so resolve it from the application once\n\t// (via a throwaway subscribe whose info() resolves when the app calls accept)\n\t// and reuse it for every later TRACK request of the same track. Keyed by\n\t// `broadcast\\0track`. A rejected lookup is evicted so a retry can re-probe.\n\t#trackInfo = new Map<string, Promise<TrackInfoMessage>>();\n\n\t/**\n\t * Creates a new Publisher instance.\n\t * @param quic - The WebTransport session to use\n\t * @param version - Negotiated protocol version\n\t * @param origin - Origin id shared with the Subscriber\n\t *\n\t * @internal\n\t */\n\tconstructor(quic: WebTransport, version: Version, origin: Origin) {\n\t\tthis.#quic = quic;\n\t\tthis.version = version;\n\t\tthis.origin = origin;\n\n\t\t// Grab the datagram writer up front when the transport carries datagrams (no group\n\t\t// fallback, so it stays undefined otherwise). One writer for all subscriptions.\n\t\tif (hasDatagrams(version)) {\n\t\t\tthis.#datagramWriter = DatagramStream.datagramWriter(quic);\n\t\t}\n\t}\n\n\t/**\n\t * Publishes a broadcast with any associated tracks.\n\t * @param name - The broadcast to publish\n\t */\n\tpublish(path: Path.Valid, broadcast: broadcast.Producer) {\n\t\tthis.#broadcasts.mutate((broadcasts) => {\n\t\t\tif (!broadcasts) throw new Error(\"closed\");\n\t\t\tbroadcasts.set(path, broadcast);\n\t\t});\n\n\t\t// Remove the broadcast from the lookup when it's closed.\n\t\tvoid broadcast.closed.then(() => {\n\t\t\tthis.#broadcasts.mutate((broadcasts) => {\n\t\t\t\tbroadcasts?.delete(path);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Handles an announce interest message.\n\t * @param msg - The announce interest message\n\t * @param stream - The stream to write announcements to\n\t *\n\t * @internal\n\t */\n\tasync runAnnounce(msg: AnnounceRequest, stream: Stream) {\n\t\tconsole.debug(`announce: prefix=${msg.prefix}`);\n\n\t\t// Send initial announcements\n\t\tlet active = new Set<Path.Valid>();\n\n\t\tconst broadcasts = this.#broadcasts.peek();\n\t\tif (!broadcasts) return; // closed\n\n\t\tfor (const name of broadcasts.keys()) {\n\t\t\tconst suffix = Path.stripPrefix(msg.prefix, name);\n\t\t\tif (suffix === null) continue;\n\t\t\tconsole.debug(`announce: broadcast=${name} active=true`);\n\t\t\tactive.add(suffix);\n\t\t}\n\n\t\t// Lite06+: announce ids. Every active we send implicitly assigns the next\n\t\t// per-stream ordinal; ended references the id instead of repeating the path.\n\t\tlet nextAnnounceId = 0n;\n\t\tconst announceIds = new Map<Path.Valid, bigint>();\n\n\t\tswitch (this.version) {\n\t\t\tcase Version.DRAFT_01:\n\t\t\tcase Version.DRAFT_02: {\n\t\t\t\tconst init = new AnnounceInit([...active]);\n\t\t\t\tawait init.encode(stream.writer, this.version);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (!hasAnnounceOk(this.version)) {\n\t\t\t\t\t// Draft03/04: send individual Announce messages, stamping our origin as a hop.\n\t\t\t\t\tfor (const suffix of active) {\n\t\t\t\t\t\tawait encodeAnnounceBroadcast(\n\t\t\t\t\t\t\tstream.writer,\n\t\t\t\t\t\t\t{ status: \"active\", suffix, hops: [this.origin] },\n\t\t\t\t\t\t\tthis.version,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Report our origin id once via AnnounceOk and the count of initial announces\n\t\t\t\t// that follow; the subscriber stamps our origin onto each hop chain, so we omit it.\n\t\t\t\tconst ok = new AnnounceOk(this.origin, active.size);\n\t\t\t\tawait ok.encode(stream.writer, this.version);\n\t\t\t\tfor (const suffix of active) {\n\t\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\t\tannounceIds.set(suffix, nextAnnounceId++);\n\t\t\t\t\t}\n\t\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"active\", suffix, hops: [] }, this.version);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Wait for updates to the broadcasts.\n\t\tfor (;;) {\n\t\t\t// TODO Make a better helper within Signals.\n\t\t\tlet dispose!: Dispose;\n\t\t\tconst changed = new Promise<Map<Path.Valid, broadcast.Producer> | undefined>((resolve) => {\n\t\t\t\tdispose = this.#broadcasts.changed(resolve);\n\t\t\t});\n\n\t\t\t// Wait until the map of broadcasts changes.\n\t\t\tconst broadcasts = await Promise.race([changed, stream.reader.closed]);\n\t\t\tdispose();\n\t\t\tif (!broadcasts) break;\n\n\t\t\t// Create a new set of active broadcasts.\n\t\t\t// This is SLOW, but it's not worth optimizing because we often have just 1 broadcast anyway.\n\t\t\tconst newActive = new Set<Path.Valid>();\n\t\t\tfor (const name of broadcasts.keys()) {\n\t\t\t\tconst suffix = Path.stripPrefix(msg.prefix, name);\n\t\t\t\tif (suffix === null) continue; // Not our prefix.\n\t\t\t\tnewActive.add(suffix);\n\t\t\t}\n\n\t\t\t// Announce any new broadcasts. Lite05+ reports our origin once via AnnounceOk, so\n\t\t\t// the subscriber stamps it onto each hop chain; older versions stamp it here.\n\t\t\tfor (const added of newActive.difference(active)) {\n\t\t\t\tconsole.debug(`announce: broadcast=${added} active=true`);\n\t\t\t\tconst hops = hasAnnounceOk(this.version) ? [] : [this.origin];\n\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\tannounceIds.set(added, nextAnnounceId++);\n\t\t\t\t}\n\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"active\", suffix: added, hops }, this.version);\n\t\t\t}\n\n\t\t\t// Announce any removed broadcasts. Lite06+ retracts by announce id;\n\t\t\t// older versions repeat the path (ended announces don't need hops).\n\t\t\tfor (const removed of active.difference(newActive)) {\n\t\t\t\tconsole.debug(`announce: broadcast=${removed} active=false`);\n\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\tconst id = announceIds.get(removed);\n\t\t\t\t\tannounceIds.delete(removed);\n\t\t\t\t\tif (id === undefined) continue; // never announced\n\t\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"endedId\", id }, this.version);\n\t\t\t\t} else {\n\t\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"ended\", suffix: removed }, this.version);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// NOTE: This is kind of a hack that won't work with a rapid UNANNOUNCE/ANNOUNCE cycle.\n\t\t\t// However, our client doesn't do that anyway.\n\n\t\t\tactive = newActive;\n\t\t}\n\t}\n\n\t/**\n\t * Handles a subscribe message.\n\t * @param msg - The subscribe message\n\t * @param stream - The stream to write track data to\n\t *\n\t * @internal\n\t */\n\tasync runSubscribe(msg: Subscribe, stream: Stream) {\n\t\tconst broadcast = this.#broadcasts.peek()?.get(msg.broadcast);\n\t\tif (!broadcast) {\n\t\t\tconsole.debug(`publish unknown: broadcast=${msg.broadcast}`);\n\t\t\tstream.writer.reset(new Error(\"not found\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst track = broadcast.subscribe(msg.track, { priority: msg.priority });\n\n\t\t// The best-effort datagram loop, started once serving begins. It parks when the\n\t\t// track finishes (recvDatagram returns undefined), so #runTrack alone ends the\n\t\t// subscription; awaited during teardown so it doesn't outlive the subscription.\n\t\tlet datagrams: Promise<void> | undefined;\n\n\t\ttry {\n\t\t\tlet timescale: Timescale = Timescale.MILLI;\n\n\t\t\tif (supportsTrackStream(this.version)) {\n\t\t\t\t// Lite-05+ accepts implicitly: no SUBSCRIBE_OK (the immutable\n\t\t\t\t// properties live in TRACK_INFO), and the resolved range arrives as\n\t\t\t\t// SUBSCRIBE_START / SUBSCRIBE_END emitted from #runTrack.\n\t\t\t\t//\n\t\t\t\t// The timescale is an immutable property, so serving MUST use exactly\n\t\t\t\t// what TRACK_INFO advertised. It comes from the producer's accept(), so\n\t\t\t\t// they always agree. Awaiting info() also surfaces a rejected track\n\t\t\t\t// (accept never called, track closed) as an error here, which resets the\n\t\t\t\t// stream.\n\t\t\t\tconst info = await track.info();\n\t\t\t\ttimescale = info.timescale;\n\t\t\t} else {\n\t\t\t\t// Older drafts acknowledge with SUBSCRIBE_OK and stream frames verbatim.\n\t\t\t\tconst ok = new SubscribeOk({ priority: msg.priority });\n\t\t\t\tawait encodeSubscribeResponse(stream.writer, { ok }, this.version);\n\t\t\t}\n\n\t\t\tconsole.debug(`publish ok: broadcast=${msg.broadcast} track=${track.name}`);\n\n\t\t\tconst serving = this.#runTrack(msg.id, msg.broadcast, track, stream.writer, timescale);\n\n\t\t\t// Serve datagrams concurrently with groups whenever the transport carries them\n\t\t\t// (the writer exists iff so). No group fallback: otherwise they simply aren't sent.\n\t\t\tif (this.#datagramWriter) {\n\t\t\t\tdatagrams = this.#runDatagrams(msg.id, track, timescale);\n\t\t\t}\n\n\t\t\tfor (;;) {\n\t\t\t\tconst decode = SubscribeUpdate.decodeMaybe(stream.reader, this.version);\n\n\t\t\t\tconst result = await Promise.any([serving, decode]);\n\t\t\t\tif (!result) break;\n\n\t\t\t\tif (result instanceof SubscribeUpdate) {\n\t\t\t\t\tconsole.debug(\n\t\t\t\t\t\t`subscribe update: broadcast=${msg.broadcast} track=${track.name} priority=${result.priority}`,\n\t\t\t\t\t);\n\t\t\t\t\ttrack.update({ priority: result.priority });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.debug(`publish done: broadcast=${msg.broadcast} track=${track.name}`);\n\t\t\tstream.close();\n\t\t\ttrack.close();\n\t\t\t// track.close ends the datagram loop; wait so it doesn't leak past teardown.\n\t\t\tawait datagrams;\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(`publish error: broadcast=${msg.broadcast} track=${track.name} error=${reason(e)}`);\n\t\t\ttrack.close(e);\n\t\t\tstream.abort(e);\n\t\t\tawait datagrams;\n\t\t}\n\t}\n\n\t/**\n\t * Handles a FETCH stream by serving one group as bare frame records (lite-05+).\n\t *\n\t * @internal\n\t */\n\tasync runFetch(msg: Fetch, stream: Stream) {\n\t\tif (!supportsTrackStream(this.version)) {\n\t\t\tstream.writer.reset(new Error(\"fetch requires moq-lite-05 or newer\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst broadcast = this.#broadcasts.peek()?.get(msg.broadcast);\n\t\tif (!broadcast) {\n\t\t\tconsole.debug(`fetch unknown: broadcast=${msg.broadcast}`);\n\t\t\tstream.writer.reset(new Error(\"not found\"));\n\t\t\treturn;\n\t\t}\n\n\t\tlet group: group.Consumer | undefined;\n\t\ttry {\n\t\t\t// The timescale is immutable, so serve exactly what TRACK_INFO advertised.\n\t\t\tconst info = await this.#resolveTrackInfo(msg.broadcast, msg.track);\n\t\t\tgroup = await broadcast.track(msg.track).fetchGroup(msg.group, { priority: msg.priority });\n\t\t\tawait this.#runFetchGroup(group, stream.writer, Timescale(info.timescale));\n\t\t\tconsole.debug(`fetch done: broadcast=${msg.broadcast} track=${msg.track} group=${msg.group}`);\n\t\t\tstream.close();\n\t\t\tgroup.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(\n\t\t\t\t`fetch error: broadcast=${msg.broadcast} track=${msg.track} group=${msg.group} error=${reason(e)}`,\n\t\t\t);\n\t\t\tgroup?.close(e);\n\t\t\tstream.abort(e);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a track and sends its data to the stream.\n\t * @param sub - The subscription ID\n\t * @param broadcast - The broadcast name\n\t * @param track - The track to run\n\t * @param stream - The stream to write to\n\t *\n\t * @internal\n\t */\n\tasync #runTrack(sub: bigint, broadcast: Path.Valid, track: track.Subscriber, stream: Writer, timescale: Timescale) {\n\t\t// Lite-05+ resolves the range on the subscribe stream: SUBSCRIBE_START once the\n\t\t// first group is known, SUBSCRIBE_END when the track finishes.\n\t\tconst emitRange = supportsTrackStream(this.version);\n\t\tlet startSent = false;\n\n\t\t// The exclusive end of the delivered range. recvGroup is arrival-ordered rather than\n\t\t// sequence-ordered, so this tracks the max and not the last group seen. 0 is already\n\t\t// the encoding for a track that produced no groups.\n\t\tlet end = 0;\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst next = track.recvGroup();\n\t\t\t\tconst group = await Promise.race([next, stream.closed]);\n\t\t\t\tif (!group) {\n\t\t\t\t\tnext.then((group) => group?.close()).catch(() => {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (emitRange && !startSent) {\n\t\t\t\t\tstartSent = true;\n\t\t\t\t\tawait encodeSubscribeResponse(stream, { start: new SubscribeStart(group.sequence) }, this.version);\n\t\t\t\t}\n\t\t\t\tend = Math.max(end, group.sequence + 1);\n\n\t\t\t\tvoid this.#runGroup(sub, group, timescale);\n\t\t\t}\n\n\t\t\tif (emitRange) {\n\t\t\t\tawait encodeSubscribeResponse(stream, { end: new SubscribeEnd(end) }, this.version);\n\t\t\t}\n\n\t\t\tconsole.debug(`publish close: broadcast=${broadcast} track=${track.name}`);\n\t\t\ttrack.close();\n\t\t\tstream.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(`publish error: broadcast=${broadcast} track=${track.name} error=${reason(e)}`);\n\t\t\ttrack.close(e);\n\t\t\tstream.reset(e);\n\t\t}\n\t}\n\n\t/**\n\t * Answers a TRACK stream (0x6) with a single TRACK_INFO, then FINs.\n\t *\n\t * @internal\n\t */\n\tasync runTrackInfo(msg: TrackMessage, stream: Stream) {\n\t\ttry {\n\t\t\tconst info = await this.#resolveTrackInfo(msg.broadcast, msg.track);\n\t\t\tawait info.encode(stream.writer, this.version);\n\t\t\tconsole.debug(`track info: broadcast=${msg.broadcast} track=${msg.track}`);\n\t\t\tstream.close();\n\t\t} catch (err) {\n\t\t\tconsole.debug(`track unknown: broadcast=${msg.broadcast} track=${msg.track}`);\n\t\t\tstream.writer.reset(error(err));\n\t\t}\n\t}\n\n\t// Resolve (and cache) a track's immutable TRACK_INFO by asking the application.\n\t// `broadcast.track(name).info()` triggers a TrackRequest the app answers with\n\t// accept(TrackInfo); only the immutable properties are needed (not the groups).\n\t// Cached because they're fixed for the track's lifetime. Rejects if the broadcast\n\t// or track is unavailable.\n\t#resolveTrackInfo(broadcast: Path.Valid, track: string): Promise<TrackInfoMessage> {\n\t\tconst key = `${broadcast}\\0${track}`;\n\t\tconst cached = this.#trackInfo.get(key);\n\t\tif (cached) return cached;\n\n\t\tconst pending = (async () => {\n\t\t\tconst published = this.#broadcasts.peek()?.get(broadcast);\n\t\t\tif (!published) throw new Error(\"not found\");\n\n\t\t\tconst info = await published.track(track).info();\n\t\t\treturn new TrackInfoMessage({\n\t\t\t\tpriority: info.priority,\n\t\t\t\tordered: info.ordered,\n\t\t\t\t// Publisher Max Latency: the publisher's retention bound, advertised so\n\t\t\t\t// relays re-serve with the same window.\n\t\t\t\tlatencyMax: info.latencyMax,\n\t\t\t\t// Lite05 mandates per-frame timestamps. Advertise the track's timescale;\n\t\t\t\t// `#runGroup` emits each frame converted to it.\n\t\t\t\ttimescale: info.timescale,\n\t\t\t});\n\t\t})();\n\n\t\t// Don't poison the cache on failure: a later request may succeed.\n\t\tpending.catch(() => this.#trackInfo.delete(key));\n\t\tthis.#trackInfo.set(key, pending);\n\t\treturn pending;\n\t}\n\n\t/**\n\t * Forwards a track's datagrams best-effort over QUIC datagrams (lite-05 §6.4), parallel to\n\t * its groups. Each datagram is dropped (there is no group fallback) if the encoded body\n\t * doesn't fit the transport's datagram limit or the send fails. Returns once the track\n\t * finishes; a failure never tears down the subscription.\n\t *\n\t * @internal\n\t */\n\tasync #runDatagrams(sub: bigint, track: track.Subscriber, timescale: Timescale) {\n\t\tconst writer = this.#datagramWriter;\n\t\tif (!writer) return; // Only reached with a writer (see the #datagramWriter gate).\n\t\tconst maxSize = DatagramStream.maxDatagramSize(this.#quic);\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst datagram = await track.recvDatagram();\n\t\t\t\tif (!datagram) return; // Track finished; #runTrack tears the subscription down.\n\n\t\t\t\t// Convert the timestamp to the track's advertised timescale, matching #runGroup.\n\t\t\t\tconst ts = Math.round(datagram.timestamp.as(timescale));\n\t\t\t\tconst body = new DatagramMessage(sub, datagram.sequence, ts, datagram.payload).encode();\n\n\t\t\t\t// No group fallback: drop anything that doesn't fit a single datagram.\n\t\t\t\tif (body.byteLength > maxSize) {\n\t\t\t\t\tconsole.debug(`dropping oversize datagram: sub=${sub} size=${body.byteLength} max=${maxSize}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tawait writer.ready;\n\t\t\t\tawait writer.write(body);\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\t// Best-effort: a datagram send failure stops sending but never fails the subscription.\n\t\t\tconsole.debug(`datagram send stopped: sub=${sub} error=${reason(err)}`);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a group and sends its frames to the stream.\n\t * @param sub - The subscription ID\n\t * @param group - The group to run\n\t *\n\t * @internal\n\t */\n\t// Serialize a fetched group's frames onto the FETCH stream as bare records: each a\n\t// zigzag-delta timestamp (at the track's advertised timescale) followed by size + bytes.\n\tasync #runFetchGroup(group: group.Consumer, stream: Writer, timescale: Timescale) {\n\t\tlet prevTs = 0n;\n\t\tfor (;;) {\n\t\t\tconst frame = await Promise.race([group.readFrame(), stream.closed]);\n\t\t\tif (!frame) break;\n\n\t\t\tconst ts = BigInt(Math.round(frame.timestamp.as(timescale)));\n\t\t\tawait stream.u62(zigzag(ts - prevTs));\n\t\t\tprevTs = ts;\n\n\t\t\tawait stream.u53(frame.payload.byteLength);\n\t\t\tawait stream.write(frame.payload);\n\t\t}\n\t}\n\n\tasync #runGroup(sub: bigint, group: group.Consumer, timescale: Timescale) {\n\t\tconst msg = new GroupMessage(sub, group.sequence);\n\t\ttry {\n\t\t\tconst stream = await Writer.open(this.#quic);\n\t\t\tawait stream.u53(0); // stream type\n\t\t\tawait msg.encode(stream);\n\n\t\t\t// Lite05+ prefixes every frame with a zigzag-delta timestamp at the track's\n\t\t\t// advertised timescale; older drafts omit it.\n\t\t\tconst timestamps = supportsTrackStream(this.version);\n\t\t\tlet prevTs = 0n;\n\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst frame = await Promise.race([group.readFrame(), stream.closed]);\n\t\t\t\t\tif (!frame) break;\n\n\t\t\t\t\tif (timestamps) {\n\t\t\t\t\t\t// Convert each frame to the track's advertised timescale.\n\t\t\t\t\t\tconst ts = BigInt(Math.round(frame.timestamp.as(timescale)));\n\t\t\t\t\t\tawait stream.u62(zigzag(ts - prevTs));\n\t\t\t\t\t\tprevTs = ts;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait stream.u53(frame.payload.byteLength);\n\t\t\t\t\tawait stream.write(frame.payload);\n\t\t\t\t}\n\n\t\t\t\tstream.close();\n\t\t\t\tgroup.close();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tconst e = error(err);\n\t\t\t\tstream.reset(e);\n\t\t\t\tgroup.close(e);\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tgroup.close(e);\n\t\t}\n\t}\n\n\t/**\n\t * Handles a probe stream by periodically reporting estimated bitrate.\n\t * @param stream - The probe bidi stream\n\t *\n\t * @internal\n\t */\n\tasync runProbe(stream: Stream) {\n\t\t// getStats is not yet in the TypeScript WebTransport type definitions.\n\t\tconst quic = this.#quic as unknown as {\n\t\t\tgetStats?: () => Promise<{ estimatedSendRate: number | null }>;\n\t\t};\n\t\tif (!quic.getStats) {\n\t\t\t// Best-effort: we can't supply bandwidth estimates, so close the\n\t\t\t// whole bidi (FIN + STOP_SENDING) to let the peer release its end.\n\t\t\tstream.close();\n\t\t\treturn;\n\t\t}\n\n\t\tlet lastSentBitrate: number | undefined;\n\t\tlet lastSentTime: number | undefined;\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst timeout = new Promise<\"timeout\">((resolve) =>\n\t\t\t\t\tsetTimeout(() => resolve(\"timeout\"), PROBE_INTERVAL),\n\t\t\t\t);\n\t\t\t\tconst result = await Promise.race([timeout, stream.reader.closed]);\n\t\t\t\tif (result !== \"timeout\") break;\n\n\t\t\t\tconst stats = await quic.getStats();\n\t\t\t\tconst bitrate = stats.estimatedSendRate;\n\t\t\t\tif (bitrate == null) continue;\n\n\t\t\t\tlet shouldSend: boolean;\n\t\t\t\tif (lastSentBitrate === undefined || lastSentTime === undefined) {\n\t\t\t\t\tshouldSend = true;\n\t\t\t\t} else if (lastSentBitrate === 0) {\n\t\t\t\t\tshouldSend = bitrate > 0;\n\t\t\t\t} else {\n\t\t\t\t\tconst elapsed = performance.now() - lastSentTime;\n\t\t\t\t\tconst t = Math.max(PROBE_INTERVAL, Math.min(PROBE_MAX_AGE, elapsed));\n\t\t\t\t\tconst range = PROBE_MAX_AGE - PROBE_INTERVAL;\n\t\t\t\t\tconst threshold = (PROBE_MAX_DELTA * (PROBE_MAX_AGE - t)) / range;\n\t\t\t\t\tconst change = Math.abs(bitrate - lastSentBitrate) / lastSentBitrate;\n\t\t\t\t\tshouldSend = change >= threshold;\n\t\t\t\t}\n\n\t\t\t\tif (shouldSend) {\n\t\t\t\t\tawait new Probe(bitrate).encode(stream.writer, this.version);\n\t\t\t\t\tlastSentBitrate = bitrate;\n\t\t\t\t\tlastSentTime = performance.now();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconsole.warn(\"probe stream error\", err);\n\t\t\tstream.close();\n\t\t}\n\t}\n\n\tclose() {\n\t\tthis.#broadcasts.update((broadcasts) => {\n\t\t\tfor (const broadcast of broadcasts?.values() ?? []) {\n\t\t\t\tbroadcast.close();\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\n\t\t// Release the datagram writer's lock so the stream can be torn down.\n\t\tthis.#datagramWriter?.release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AAW,EAAE,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IAClC,CAAC;CACD","sourcesContent":["import { type Dispose, Signal } from \"@moq/signals\";\nimport type * as broadcast from \"../broadcast.ts\";\nimport { error, reason } from \"../error.ts\";\nimport type * as group from \"../group.ts\";\nimport * as Path from \"../path.ts\";\nimport { type Stream, Writer } from \"../stream.ts\";\nimport { Timescale } from \"../time.ts\";\nimport type * as track from \"../track.ts\";\nimport { AnnounceInit, AnnounceOk, type AnnounceRequest, encodeAnnounceBroadcast } from \"./announce.ts\";\nimport { Datagram as DatagramMessage } from \"./datagram.ts\";\nimport * as DatagramStream from \"./datagram_stream.ts\";\nimport type { Fetch } from \"./fetch.ts\";\nimport { Group as GroupMessage } from \"./group.ts\";\nimport type { Origin } from \"./origin.ts\";\nimport { Probe } from \"./probe.ts\";\nimport {\n\tencodeSubscribeResponse,\n\ttype Subscribe,\n\tSubscribeEnd,\n\tSubscribeOk,\n\tSubscribeStart,\n\tSubscribeUpdate,\n} from \"./subscribe.ts\";\nimport { TrackInfo as TrackInfoMessage, type Track as TrackMessage } from \"./track.ts\";\nimport { hasAnnounceId, hasAnnounceOk, hasDatagrams, Version } from \"./version.ts\";\n\nconst PROBE_INTERVAL = 100; // ms\nconst PROBE_MAX_AGE = 10_000; // ms\nconst PROBE_MAX_DELTA = 0.25;\n\n/** Map a signed delta to an unsigned zigzag varint value (mirrors Rust `VarInt::from_zigzag`). */\nfunction zigzag(delta: bigint): bigint {\n\treturn delta >= 0n ? delta << 1n : (-delta << 1n) - 1n;\n}\n\n// The TRACK stream, implicit SUBSCRIBE acceptance, and SUBSCRIBE_START/END are\n// all lite-05+.\nfunction supportsTrackStream(version: Version): boolean {\n\tswitch (version) {\n\t\tcase Version.DRAFT_01:\n\t\tcase Version.DRAFT_02:\n\t\tcase Version.DRAFT_03:\n\t\tcase Version.DRAFT_04:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n\n/**\n * Handles publishing broadcasts and managing their lifecycle.\n *\n * @internal\n */\nexport class Publisher {\n\t// The version of the connection.\n\treadonly version: Version;\n\n\t// Per-connection origin appended to outbound Announce hops, so the peer\n\t// can detect loops and prefer shorter paths. Created by Connection and\n\t// shared with Subscriber, which can optionally use it to filter out its\n\t// own announcements.\n\treadonly origin: Origin;\n\n\t#quic: WebTransport;\n\n\t// The one writer for the outbound datagram stream (getWriter locks it), acquired once at\n\t// construction when this version + transport carry datagrams, released in close(). Its\n\t// presence is the gate: undefined means datagrams aren't served on this connection. All\n\t// subscriptions share it, since a second getWriter on the same stream would throw.\n\t#datagramWriter?: WritableStreamDefaultWriter<Uint8Array>;\n\n\t// Our published broadcasts.\n\t// It's a signal so we can live update any announce streams.\n\t#broadcasts = new Signal<Map<Path.Valid, broadcast.Producer> | undefined>(new Map());\n\n\t// TRACK_INFO is immutable per track, so resolve it from the application once\n\t// (via a throwaway subscribe whose info() resolves when the app calls accept)\n\t// and reuse it for every later TRACK request of the same track. Keyed by\n\t// `broadcast\\0track`. A rejected lookup is evicted so a retry can re-probe.\n\t#trackInfo = new Map<string, Promise<TrackInfoMessage>>();\n\n\t/**\n\t * Creates a new Publisher instance.\n\t * @param quic - The WebTransport session to use\n\t * @param version - Negotiated protocol version\n\t * @param origin - Origin id shared with the Subscriber\n\t *\n\t * @internal\n\t */\n\tconstructor(quic: WebTransport, version: Version, origin: Origin) {\n\t\tthis.#quic = quic;\n\t\tthis.version = version;\n\t\tthis.origin = origin;\n\n\t\t// Grab the datagram writer up front when the transport carries datagrams (no group\n\t\t// fallback, so it stays undefined otherwise). One writer for all subscriptions.\n\t\tif (hasDatagrams(version)) {\n\t\t\tthis.#datagramWriter = DatagramStream.datagramWriter(quic);\n\t\t}\n\t}\n\n\t/**\n\t * Publishes a broadcast with any associated tracks.\n\t * @param name - The broadcast to publish\n\t */\n\tpublish(path: Path.Valid, broadcast: broadcast.Producer) {\n\t\tthis.#broadcasts.mutate((broadcasts) => {\n\t\t\tif (!broadcasts) throw new Error(\"closed\");\n\t\t\tbroadcasts.set(path, broadcast);\n\t\t});\n\n\t\t// Remove the broadcast from the lookup when it's closed.\n\t\tvoid broadcast.closed.then(() => {\n\t\t\tthis.#broadcasts.mutate((broadcasts) => {\n\t\t\t\tbroadcasts?.delete(path);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Handles an announce interest message.\n\t * @param msg - The announce interest message\n\t * @param stream - The stream to write announcements to\n\t *\n\t * @internal\n\t */\n\tasync runAnnounce(msg: AnnounceRequest, stream: Stream) {\n\t\tconsole.debug(`announce: prefix=${msg.prefix}`);\n\n\t\t// Send initial announcements\n\t\tlet active = new Set<Path.Valid>();\n\n\t\tconst broadcasts = this.#broadcasts.peek();\n\t\tif (!broadcasts) return; // closed\n\n\t\tfor (const name of broadcasts.keys()) {\n\t\t\tconst suffix = Path.stripPrefix(msg.prefix, name);\n\t\t\tif (suffix === null) continue;\n\t\t\tconsole.debug(`announce: broadcast=${name} active=true`);\n\t\t\tactive.add(suffix);\n\t\t}\n\n\t\t// Lite06+: announce ids. Every active we send implicitly assigns the next\n\t\t// per-stream ordinal; ended references the id instead of repeating the path.\n\t\tlet nextAnnounceId = 0n;\n\t\tconst announceIds = new Map<Path.Valid, bigint>();\n\n\t\tswitch (this.version) {\n\t\t\tcase Version.DRAFT_01:\n\t\t\tcase Version.DRAFT_02: {\n\t\t\t\tconst init = new AnnounceInit([...active]);\n\t\t\t\tawait init.encode(stream.writer, this.version);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (!hasAnnounceOk(this.version)) {\n\t\t\t\t\t// Draft03/04: send individual Announce messages, stamping our origin as a hop.\n\t\t\t\t\tfor (const suffix of active) {\n\t\t\t\t\t\tawait encodeAnnounceBroadcast(\n\t\t\t\t\t\t\tstream.writer,\n\t\t\t\t\t\t\t{ status: \"active\", suffix, hops: [this.origin] },\n\t\t\t\t\t\t\tthis.version,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Report our origin id once via AnnounceOk and the count of initial announces\n\t\t\t\t// that follow; the subscriber stamps our origin onto each hop chain, so we omit it.\n\t\t\t\tconst ok = new AnnounceOk(this.origin, active.size);\n\t\t\t\tawait ok.encode(stream.writer, this.version);\n\t\t\t\tfor (const suffix of active) {\n\t\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\t\tannounceIds.set(suffix, nextAnnounceId++);\n\t\t\t\t\t}\n\t\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"active\", suffix, hops: [] }, this.version);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Wait for updates to the broadcasts.\n\t\tfor (;;) {\n\t\t\t// TODO Make a better helper within Signals.\n\t\t\tlet dispose!: Dispose;\n\t\t\tconst changed = new Promise<Map<Path.Valid, broadcast.Producer> | undefined>((resolve) => {\n\t\t\t\tdispose = this.#broadcasts.changed(resolve);\n\t\t\t});\n\n\t\t\t// Wait until the map of broadcasts changes.\n\t\t\tconst broadcasts = await Promise.race([changed, stream.reader.closed]);\n\t\t\tdispose();\n\t\t\tif (!broadcasts) break;\n\n\t\t\t// Create a new set of active broadcasts.\n\t\t\t// This is SLOW, but it's not worth optimizing because we often have just 1 broadcast anyway.\n\t\t\tconst newActive = new Set<Path.Valid>();\n\t\t\tfor (const name of broadcasts.keys()) {\n\t\t\t\tconst suffix = Path.stripPrefix(msg.prefix, name);\n\t\t\t\tif (suffix === null) continue; // Not our prefix.\n\t\t\t\tnewActive.add(suffix);\n\t\t\t}\n\n\t\t\t// Announce any new broadcasts. Lite05+ reports our origin once via AnnounceOk, so\n\t\t\t// the subscriber stamps it onto each hop chain; older versions stamp it here.\n\t\t\tfor (const added of newActive.difference(active)) {\n\t\t\t\tconsole.debug(`announce: broadcast=${added} active=true`);\n\t\t\t\tconst hops = hasAnnounceOk(this.version) ? [] : [this.origin];\n\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\tannounceIds.set(added, nextAnnounceId++);\n\t\t\t\t}\n\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"active\", suffix: added, hops }, this.version);\n\t\t\t}\n\n\t\t\t// Announce any removed broadcasts. Lite06+ retracts by announce id;\n\t\t\t// older versions repeat the path (ended announces don't need hops).\n\t\t\tfor (const removed of active.difference(newActive)) {\n\t\t\t\tconsole.debug(`announce: broadcast=${removed} active=false`);\n\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\tconst id = announceIds.get(removed);\n\t\t\t\t\tannounceIds.delete(removed);\n\t\t\t\t\tif (id === undefined) continue; // never announced\n\t\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"endedId\", id }, this.version);\n\t\t\t\t} else {\n\t\t\t\t\tawait encodeAnnounceBroadcast(stream.writer, { status: \"ended\", suffix: removed }, this.version);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// NOTE: This is kind of a hack that won't work with a rapid UNANNOUNCE/ANNOUNCE cycle.\n\t\t\t// However, our client doesn't do that anyway.\n\n\t\t\tactive = newActive;\n\t\t}\n\t}\n\n\t/**\n\t * Handles a subscribe message.\n\t * @param msg - The subscribe message\n\t * @param stream - The stream to write track data to\n\t *\n\t * @internal\n\t */\n\tasync runSubscribe(msg: Subscribe, stream: Stream) {\n\t\tconst broadcast = this.#broadcasts.peek()?.get(msg.broadcast);\n\t\tif (!broadcast) {\n\t\t\tconsole.debug(`publish unknown: broadcast=${msg.broadcast}`);\n\t\t\tstream.writer.reset(new Error(\"not found\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst track = broadcast.subscribe(msg.track, { priority: msg.priority });\n\n\t\t// The best-effort datagram loop, started once serving begins. It parks when the\n\t\t// track finishes (recvDatagram returns undefined), so #runTrack alone ends the\n\t\t// subscription; awaited during teardown so it doesn't outlive the subscription.\n\t\tlet datagrams: Promise<void> | undefined;\n\n\t\ttry {\n\t\t\tlet timescale: Timescale = Timescale.MILLI;\n\n\t\t\tif (supportsTrackStream(this.version)) {\n\t\t\t\t// Lite-05+ accepts implicitly: no SUBSCRIBE_OK (the immutable\n\t\t\t\t// properties live in TRACK_INFO), and the resolved range arrives as\n\t\t\t\t// SUBSCRIBE_START / SUBSCRIBE_END emitted from #runTrack.\n\t\t\t\t//\n\t\t\t\t// The timescale is an immutable property, so serving MUST use exactly\n\t\t\t\t// what TRACK_INFO advertised. It comes from the producer's accept(), so\n\t\t\t\t// they always agree. Awaiting info() also surfaces a rejected track\n\t\t\t\t// (accept never called, track closed) as an error here, which resets the\n\t\t\t\t// stream.\n\t\t\t\tconst info = await track.info();\n\t\t\t\ttimescale = info.timescale;\n\t\t\t} else {\n\t\t\t\t// Older drafts acknowledge with SUBSCRIBE_OK and stream frames verbatim.\n\t\t\t\tconst ok = new SubscribeOk({ priority: msg.priority });\n\t\t\t\tawait encodeSubscribeResponse(stream.writer, { ok }, this.version);\n\t\t\t}\n\n\t\t\tconsole.debug(`publish ok: broadcast=${msg.broadcast} track=${track.name}`);\n\n\t\t\tconst serving = this.#runTrack(msg.id, msg.broadcast, track, stream.writer, timescale);\n\n\t\t\t// Serve datagrams concurrently with groups whenever the transport carries them\n\t\t\t// (the writer exists iff so). No group fallback: otherwise they simply aren't sent.\n\t\t\tif (this.#datagramWriter) {\n\t\t\t\tdatagrams = this.#runDatagrams(msg.id, track, timescale);\n\t\t\t}\n\n\t\t\tfor (;;) {\n\t\t\t\tconst decode = SubscribeUpdate.decodeMaybe(stream.reader, this.version);\n\n\t\t\t\tconst result = await Promise.any([serving, decode]);\n\t\t\t\tif (!result) break;\n\n\t\t\t\tif (result instanceof SubscribeUpdate) {\n\t\t\t\t\tconsole.debug(\n\t\t\t\t\t\t`subscribe update: broadcast=${msg.broadcast} track=${track.name} priority=${result.priority}`,\n\t\t\t\t\t);\n\t\t\t\t\ttrack.update({ priority: result.priority });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.debug(`publish done: broadcast=${msg.broadcast} track=${track.name}`);\n\t\t\tstream.close();\n\t\t\ttrack.close();\n\t\t\t// track.close ends the datagram loop; wait so it doesn't leak past teardown.\n\t\t\tawait datagrams;\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(`publish error: broadcast=${msg.broadcast} track=${track.name} error=${reason(e)}`);\n\t\t\ttrack.close(e);\n\t\t\tstream.abort(e);\n\t\t\tawait datagrams;\n\t\t}\n\t}\n\n\t/**\n\t * Handles a FETCH stream by serving one group as bare frame records (lite-05+).\n\t *\n\t * @internal\n\t */\n\tasync runFetch(msg: Fetch, stream: Stream) {\n\t\tif (!supportsTrackStream(this.version)) {\n\t\t\tstream.writer.reset(new Error(\"fetch requires moq-lite-05 or newer\"));\n\t\t\treturn;\n\t\t}\n\n\t\tconst broadcast = this.#broadcasts.peek()?.get(msg.broadcast);\n\t\tif (!broadcast) {\n\t\t\tconsole.debug(`fetch unknown: broadcast=${msg.broadcast}`);\n\t\t\tstream.writer.reset(new Error(\"not found\"));\n\t\t\treturn;\n\t\t}\n\n\t\tlet group: group.Consumer | undefined;\n\t\ttry {\n\t\t\t// The timescale is immutable, so serve exactly what TRACK_INFO advertised.\n\t\t\tconst info = await this.#resolveTrackInfo(msg.broadcast, msg.track);\n\t\t\tgroup = await broadcast.track(msg.track).fetchGroup(msg.group, { priority: msg.priority });\n\t\t\tawait this.#runFetchGroup(group, stream.writer, Timescale(info.timescale));\n\t\t\tconsole.debug(`fetch done: broadcast=${msg.broadcast} track=${msg.track} group=${msg.group}`);\n\t\t\tstream.close();\n\t\t\tgroup.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(\n\t\t\t\t`fetch error: broadcast=${msg.broadcast} track=${msg.track} group=${msg.group} error=${reason(e)}`,\n\t\t\t);\n\t\t\tgroup?.close(e);\n\t\t\tstream.abort(e);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a track and sends its data to the stream.\n\t * @param sub - The subscription ID\n\t * @param broadcast - The broadcast name\n\t * @param track - The track to run\n\t * @param stream - The stream to write to\n\t *\n\t * @internal\n\t */\n\tasync #runTrack(sub: bigint, broadcast: Path.Valid, track: track.Subscriber, stream: Writer, timescale: Timescale) {\n\t\t// Lite-05+ resolves the range on the subscribe stream: SUBSCRIBE_START once the\n\t\t// first group is known, SUBSCRIBE_END when the track finishes.\n\t\tconst emitRange = supportsTrackStream(this.version);\n\t\tlet startSent = false;\n\n\t\t// The exclusive end of the delivered range. recvGroup is arrival-ordered rather than\n\t\t// sequence-ordered, so this tracks the max and not the last group seen. 0 is already\n\t\t// the encoding for a track that produced no groups.\n\t\tlet end = 0;\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst next = track.recvGroup();\n\t\t\t\tconst group = await Promise.race([next, stream.closed]);\n\t\t\t\tif (!group) {\n\t\t\t\t\tnext.then((group) => group?.close()).catch(() => {});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (emitRange && !startSent) {\n\t\t\t\t\tstartSent = true;\n\t\t\t\t\tawait encodeSubscribeResponse(stream, { start: new SubscribeStart(group.sequence) }, this.version);\n\t\t\t\t}\n\t\t\t\tend = Math.max(end, group.sequence + 1);\n\n\t\t\t\tvoid this.#runGroup(sub, group, timescale);\n\t\t\t}\n\n\t\t\tif (emitRange) {\n\t\t\t\tawait encodeSubscribeResponse(stream, { end: new SubscribeEnd(end) }, this.version);\n\t\t\t}\n\n\t\t\tconsole.debug(`publish close: broadcast=${broadcast} track=${track.name}`);\n\t\t\ttrack.close();\n\t\t\tstream.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tconsole.warn(`publish error: broadcast=${broadcast} track=${track.name} error=${reason(e)}`);\n\t\t\ttrack.close(e);\n\t\t\tstream.reset(e);\n\t\t}\n\t}\n\n\t/**\n\t * Answers a TRACK stream (0x6) with a single TRACK_INFO, then FINs.\n\t *\n\t * @internal\n\t */\n\tasync runTrackInfo(msg: TrackMessage, stream: Stream) {\n\t\ttry {\n\t\t\tconst info = await this.#resolveTrackInfo(msg.broadcast, msg.track);\n\t\t\tawait info.encode(stream.writer, this.version);\n\t\t\tconsole.debug(`track info: broadcast=${msg.broadcast} track=${msg.track}`);\n\t\t\tstream.close();\n\t\t} catch (err) {\n\t\t\tconsole.debug(`track unknown: broadcast=${msg.broadcast} track=${msg.track}`);\n\t\t\tstream.writer.reset(error(err));\n\t\t}\n\t}\n\n\t// Resolve (and cache) a track's immutable TRACK_INFO by asking the application.\n\t// `broadcast.track(name).info()` triggers a TrackRequest the app answers with\n\t// accept(TrackInfo); only the immutable properties are needed (not the groups).\n\t// Cached because they're fixed for the track's lifetime. Rejects if the broadcast\n\t// or track is unavailable.\n\t#resolveTrackInfo(broadcast: Path.Valid, track: string): Promise<TrackInfoMessage> {\n\t\tconst key = `${broadcast}\\0${track}`;\n\t\tconst cached = this.#trackInfo.get(key);\n\t\tif (cached) return cached;\n\n\t\tconst pending = (async () => {\n\t\t\tconst published = this.#broadcasts.peek()?.get(broadcast);\n\t\t\tif (!published) throw new Error(\"not found\");\n\n\t\t\tconst info = await published.track(track).info();\n\t\t\treturn new TrackInfoMessage({\n\t\t\t\tpriority: info.priority,\n\t\t\t\tordered: info.ordered,\n\t\t\t\t// Publisher Max Latency: the publisher's retention bound, advertised so\n\t\t\t\t// relays re-serve with the same window.\n\t\t\t\tlatencyMax: info.latencyMax,\n\t\t\t\t// Lite05 mandates per-frame timestamps. Advertise the track's timescale;\n\t\t\t\t// `#runGroup` emits each frame converted to it.\n\t\t\t\ttimescale: info.timescale,\n\t\t\t});\n\t\t})();\n\n\t\t// Don't poison the cache on failure: a later request may succeed.\n\t\tpending.catch(() => this.#trackInfo.delete(key));\n\t\tthis.#trackInfo.set(key, pending);\n\t\treturn pending;\n\t}\n\n\t/**\n\t * Forwards a track's datagrams best-effort over QUIC datagrams (lite-05 §6.4), parallel to\n\t * its groups. Each datagram is dropped (there is no group fallback) if the encoded body\n\t * doesn't fit the transport's datagram limit or the send fails. Returns once the track\n\t * finishes; a failure never tears down the subscription.\n\t *\n\t * @internal\n\t */\n\tasync #runDatagrams(sub: bigint, track: track.Subscriber, timescale: Timescale) {\n\t\tconst writer = this.#datagramWriter;\n\t\tif (!writer) return; // Only reached with a writer (see the #datagramWriter gate).\n\t\tconst maxSize = DatagramStream.maxDatagramSize(this.#quic);\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst datagram = await track.recvDatagram();\n\t\t\t\tif (!datagram) return; // Track finished; #runTrack tears the subscription down.\n\n\t\t\t\t// Convert the timestamp to the track's advertised timescale, matching #runGroup.\n\t\t\t\tconst ts = Math.round(datagram.timestamp.as(timescale));\n\t\t\t\tconst body = new DatagramMessage(sub, datagram.sequence, ts, datagram.payload).encode();\n\n\t\t\t\t// No group fallback: drop anything that doesn't fit a single datagram.\n\t\t\t\tif (body.byteLength > maxSize) {\n\t\t\t\t\tconsole.debug(`dropping oversize datagram: sub=${sub} size=${body.byteLength} max=${maxSize}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tawait writer.ready;\n\t\t\t\tawait writer.write(body);\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\t// Best-effort: a datagram send failure stops sending but never fails the subscription.\n\t\t\tconsole.debug(`datagram send stopped: sub=${sub} error=${reason(err)}`);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a group and sends its frames to the stream.\n\t * @param sub - The subscription ID\n\t * @param group - The group to run\n\t *\n\t * @internal\n\t */\n\t// Serialize a fetched group's frames onto the FETCH stream as bare records: each a\n\t// zigzag-delta timestamp (at the track's advertised timescale) followed by size + bytes.\n\tasync #runFetchGroup(group: group.Consumer, stream: Writer, timescale: Timescale) {\n\t\tlet prevTs = 0n;\n\t\tfor (;;) {\n\t\t\tconst frame = await Promise.race([group.readFrame(), stream.closed]);\n\t\t\tif (!frame) break;\n\n\t\t\tconst ts = BigInt(Math.round(frame.timestamp.as(timescale)));\n\t\t\tawait stream.u62(zigzag(ts - prevTs));\n\t\t\tprevTs = ts;\n\n\t\t\tawait stream.u53(frame.payload.byteLength);\n\t\t\tawait stream.write(frame.payload);\n\t\t}\n\t}\n\n\tasync #runGroup(sub: bigint, group: group.Consumer, timescale: Timescale) {\n\t\tconst msg = new GroupMessage(sub, group.sequence);\n\t\ttry {\n\t\t\tconst stream = await Writer.open(this.#quic);\n\t\t\tawait stream.u53(0); // stream type\n\t\t\tawait msg.encode(stream);\n\n\t\t\t// Lite05+ prefixes every frame with a zigzag-delta timestamp at the track's\n\t\t\t// advertised timescale; older drafts omit it.\n\t\t\tconst timestamps = supportsTrackStream(this.version);\n\t\t\tlet prevTs = 0n;\n\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst frame = await Promise.race([group.readFrame(), stream.closed]);\n\t\t\t\t\tif (!frame) break;\n\n\t\t\t\t\tif (timestamps) {\n\t\t\t\t\t\t// Convert each frame to the track's advertised timescale.\n\t\t\t\t\t\tconst ts = BigInt(Math.round(frame.timestamp.as(timescale)));\n\t\t\t\t\t\tawait stream.u62(zigzag(ts - prevTs));\n\t\t\t\t\t\tprevTs = ts;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait stream.u53(frame.payload.byteLength);\n\t\t\t\t\tawait stream.write(frame.payload);\n\t\t\t\t}\n\n\t\t\t\tstream.close();\n\t\t\t\tgroup.close();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tconst e = error(err);\n\t\t\t\tstream.reset(e);\n\t\t\t\tgroup.close(e);\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tgroup.close(e);\n\t\t}\n\t}\n\n\t/**\n\t * Handles a probe stream by periodically reporting estimated bitrate.\n\t * @param stream - The probe bidi stream\n\t *\n\t * @internal\n\t */\n\tasync runProbe(stream: Stream) {\n\t\t// getStats is not yet in the TypeScript WebTransport type definitions.\n\t\tconst quic = this.#quic as unknown as {\n\t\t\tgetStats?: () => Promise<{ estimatedSendRate: number | null }>;\n\t\t};\n\t\tif (!quic.getStats) {\n\t\t\t// Best-effort: we can't supply bandwidth estimates, so close the\n\t\t\t// whole bidi (FIN + STOP_SENDING) to let the peer release its end.\n\t\t\tstream.close();\n\t\t\treturn;\n\t\t}\n\n\t\tlet lastSentBitrate: number | undefined;\n\t\tlet lastSentTime: number | undefined;\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst timeout = new Promise<\"timeout\">((resolve) =>\n\t\t\t\t\tsetTimeout(() => resolve(\"timeout\"), PROBE_INTERVAL),\n\t\t\t\t);\n\t\t\t\tconst result = await Promise.race([timeout, stream.reader.closed]);\n\t\t\t\tif (result !== \"timeout\") break;\n\n\t\t\t\tconst stats = await quic.getStats();\n\t\t\t\tconst bitrate = stats.estimatedSendRate;\n\t\t\t\tif (bitrate == null) continue;\n\n\t\t\t\tlet shouldSend: boolean;\n\t\t\t\tif (lastSentBitrate === undefined || lastSentTime === undefined) {\n\t\t\t\t\tshouldSend = true;\n\t\t\t\t} else if (lastSentBitrate === 0) {\n\t\t\t\t\tshouldSend = bitrate > 0;\n\t\t\t\t} else {\n\t\t\t\t\tconst elapsed = performance.now() - lastSentTime;\n\t\t\t\t\tconst t = Math.max(PROBE_INTERVAL, Math.min(PROBE_MAX_AGE, elapsed));\n\t\t\t\t\tconst range = PROBE_MAX_AGE - PROBE_INTERVAL;\n\t\t\t\t\tconst threshold = (PROBE_MAX_DELTA * (PROBE_MAX_AGE - t)) / range;\n\t\t\t\t\tconst change = Math.abs(bitrate - lastSentBitrate) / lastSentBitrate;\n\t\t\t\t\tshouldSend = change >= threshold;\n\t\t\t\t}\n\n\t\t\t\tif (shouldSend) {\n\t\t\t\t\tawait new Probe(bitrate).encode(stream.writer, this.version);\n\t\t\t\t\tlastSentBitrate = bitrate;\n\t\t\t\t\tlastSentTime = performance.now();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconsole.warn(\"probe stream error\", err);\n\t\t\tstream.close();\n\t\t}\n\t}\n\n\tclose() {\n\t\tthis.#broadcasts.update((broadcasts) => {\n\t\t\tfor (const broadcast of broadcasts?.values() ?? []) {\n\t\t\t\tbroadcast.close();\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\n\t\t// Release the datagram writer's lock so the stream can be torn down.\n\t\tthis.#datagramWriter?.releaseLock();\n\t\tthis.#datagramWriter = undefined;\n\t}\n}\n"]}
|
package/lite/subscriber.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["../../src/lite/subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"subscriber.d.ts","sourceRoot":"","sources":["../../src/lite/subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAM1C,OAAO,KAAK,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C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AO,CAAC,IAAI,CAAC,CAqC9B;IAED,KAAK,SAQJ;CACD"}
|
package/lite/subscriber.js
CHANGED
|
@@ -3,11 +3,11 @@ import { Signal } from "@moq/signals";
|
|
|
3
3
|
import * as announce from "../announced.js";
|
|
4
4
|
import * as broadcast from "../broadcast.js";
|
|
5
5
|
import { BroadcastCache } from "../consume.js";
|
|
6
|
+
import { error, reason } from "../error.js";
|
|
6
7
|
import * as netGroup from "../group.js";
|
|
7
8
|
import * as Path from "../path.js";
|
|
8
9
|
import { Stream } from "../stream.js";
|
|
9
10
|
import * as Time from "../time.js";
|
|
10
|
-
import { error, reason } from "../util/error.js";
|
|
11
11
|
import { withTimeout } from "../util/timeout.js";
|
|
12
12
|
import { AnnounceInit, AnnounceOk, AnnounceRequest, decodeAnnounceBroadcastMaybe } from "./announce.js";
|
|
13
13
|
import { Datagram as DatagramMessage } from "./datagram.js";
|
package/lite/subscriber.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../../src/lite/subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAe,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAA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C,CAAC;IACzE,CAAC;CACD","sourcesContent":["import { Signal } from \"@moq/signals\";\nimport * as announce from \"../announced.ts\";\nimport * as broadcast from \"../broadcast.ts\";\nimport type { Probe as ProbeStats } from \"../connection/stats.ts\";\nimport { BroadcastCache } from \"../consume.ts\";\nimport * as netGroup from \"../group.ts\";\nimport * as Path from \"../path.ts\";\nimport { type Reader, Stream } from \"../stream.ts\";\nimport * as Time from \"../time.ts\";\nimport type * as track from \"../track.ts\";\nimport { error, reason } from \"../util/error.ts\";\nimport { withTimeout } from \"../util/timeout.ts\";\nimport { AnnounceInit, AnnounceOk, AnnounceRequest, decodeAnnounceBroadcastMaybe } from \"./announce.ts\";\nimport { Datagram as DatagramMessage } from \"./datagram.ts\";\nimport * as DatagramStream from \"./datagram_stream.ts\";\nimport { Fetch as FetchMessage } from \"./fetch.ts\";\nimport type { Group as GroupMessage } from \"./group.ts\";\nimport type { Origin } from \"./origin.ts\";\nimport { Probe } from \"./probe.ts\";\nimport { ProbeLevel, type Setup } from \"./setup.ts\";\nimport { StreamId } from \"./stream.ts\";\nimport { decodeSubscribeResponse, decodeSubscribeResponseMaybe, Subscribe, SubscribeUpdate } from \"./subscribe.ts\";\nimport { TrackInfo, Track as TrackMessage } from \"./track.ts\";\nimport { hasAnnounceId, hasAnnounceOk, hasDatagrams, Version } from \"./version.ts\";\n\n// Bound on how long stream-open plus the first response (SUBSCRIBE_OK on older\n// drafts, or TRACK_INFO on lite-05+) may take. Browsers cap concurrent QUIC\n// streams (Chrome ~100); past the cap createBidirectionalStream silently blocks.\n// The timeout turns that into a clear error.\nconst SUBSCRIBE_SETUP_TIMEOUT_MS = 10_000;\n\n/** Decode an unsigned zigzag varint back to a signed delta (mirrors Rust `VarInt::to_zigzag`). */\nfunction unzigzag(v: bigint): bigint {\n\treturn (v >> 1n) ^ -(v & 1n);\n}\n\n// The TRACK stream and implicit SUBSCRIBE acceptance are lite-05+.\nfunction supportsTrackStream(version: Version): boolean {\n\tswitch (version) {\n\t\tcase Version.DRAFT_01:\n\t\tcase Version.DRAFT_02:\n\t\tcase Version.DRAFT_03:\n\t\tcase Version.DRAFT_04:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n\n/**\n * Options accepted by {@link Subscriber.announced}.\n */\nexport interface AnnouncedOptions {\n\t/**\n\t * If true, skip announcements whose hop chain contains this connection's\n\t * own origin id. Useful for meshes that reflect announces back. Defaults\n\t * to false for backwards compatibility: existing code (notably hang.live)\n\t * relies on seeing its own publishes as the signal that a namespace\n\t * published successfully.\n\t */\n\tignoreSelf?: boolean;\n}\n\ninterface SubscribeEntry {\n\t// The write side: incoming GROUP streams are routed here. The application reads\n\t// the matching track.Subscriber it got from broadcast.Consumer.subscribe.\n\ttrack: track.Producer;\n\t// Per-frame timestamp scale (0 = none). undefined until it's known (from TRACK_INFO\n\t// on lite-05+, or implicit defaults on older drafts). A non-zero value means each\n\t// frame on the group stream is prefixed with a zigzag-delta timestamp varint that\n\t// runGroup must consume to stay in sync; group streams block on it before decoding,\n\t// since a group's QUIC stream can race ahead of the subscribe stream.\n\ttimescale: Signal<number | undefined>;\n}\n\n/**\n * Handles subscribing to broadcasts and managing their lifecycle.\n *\n * @internal\n */\nexport class Subscriber {\n\t#quic: WebTransport;\n\n\t// The version of the connection.\n\treadonly version: Version;\n\n\t// Shared with the Publisher so callers can optionally filter out their\n\t// own announcements on a per-call basis (see {@link AnnouncedOptions}).\n\treadonly origin: Origin;\n\n\t// Our subscribed tracks. `timescale` resolves once known (from TRACK_INFO on\n\t// lite-05+, or implicit defaults on older drafts); group streams block on it\n\t// before decoding any frame, since a group's QUIC stream can race ahead.\n\t#subscribes = new Map<bigint, SubscribeEntry>();\n\t#subscribeNext = 0n;\n\n\t// Dedup consumed broadcasts per path: repeat consume() calls share one subscription.\n\t#consumes = new BroadcastCache();\n\n\t// Dedup in-flight one-shot fetches, keyed by [broadcast, track, sequence]. Concurrent (or\n\t// repeat, while still open) fetchGroup() calls for the same group share one FETCH stream and\n\t// each get an independent mirror; the entry is evicted once the group closes.\n\t#fetches = new Map<string, netGroup.Producer>();\n\n\t// The peer's PROBE estimates, written as they arrive (Lite03+ only).\n\t#probe?: Signal<ProbeStats>;\n\n\t// The peer's SETUP (lite-05+), undefined until it arrives. Gates opening the PROBE\n\t// stream on the peer having advertised Probe >= Report.\n\t#peerSetup?: Signal<Setup | undefined>;\n\n\t// Distinguishes failures from streams torn down by Subscriber.close().\n\t#closed = new AbortController();\n\t/**\n\t * Creates a new Subscriber instance.\n\t * @param quic - The WebTransport session to use\n\t * @param version - The protocol version\n\t * @param origin - Origin id shared with the Publisher\n\t * @param probe - Optional sink for the peer's PROBE estimates\n\t * @param peerSetup - Optional peer SETUP slot for capability gating (lite-05+)\n\t *\n\t * @internal\n\t */\n\tconstructor(\n\t\tquic: WebTransport,\n\t\tversion: Version,\n\t\torigin: Origin,\n\t\tprobe?: Signal<ProbeStats>,\n\t\tpeerSetup?: Signal<Setup | undefined>,\n\t) {\n\t\tthis.#quic = quic;\n\t\tthis.version = version;\n\t\tthis.origin = origin;\n\t\tthis.#probe = probe;\n\t\tthis.#peerSetup = peerSetup;\n\t}\n\n\t/**\n\t * Subscribe to broadcast announcements under `prefix`.\n\t *\n\t * Pass `{ ignoreSelf: true }` to skip announces that have already traversed\n\t * this connection's {@link origin}.\n\t */\n\tannounced(prefix = Path.empty(), options: AnnouncedOptions = {}): announce.Consumer {\n\t\tconst announced = new announce.Producer(prefix);\n\t\tvoid this.#runAnnounced(announced, prefix, options);\n\t\treturn announced.consume();\n\t}\n\n\tasync #runAnnounced(announced: announce.Producer, prefix: Path.Valid, options: AnnouncedOptions): Promise<void> {\n\t\tconsole.debug(`announced: prefix=${prefix}`);\n\t\t// Send our own session-level origin id so the peer can skip announces\n\t\t// whose hop chain already passed through us. Matches the Rust subscriber's\n\t\t// `exclude_hop: self.self_origin.id` in `run_announce_prefix`.\n\t\tconst msg = new AnnounceRequest(prefix, this.origin);\n\n\t\ttry {\n\t\t\t// Open a stream and send the announce interest.\n\t\t\tconst stream = await Stream.open(this.#quic);\n\t\t\tawait stream.writer.u53(StreamId.Announce);\n\t\t\tawait msg.encode(stream.writer, this.version);\n\n\t\t\t// Lite05+: the publisher reports its own origin id before any announces.\n\t\t\t// It no longer stamps itself onto each hop chain, so we append it here to\n\t\t\t// keep the ignoreSelf loop check seeing the full chain.\n\t\t\tlet responderOrigin: Origin | undefined;\n\t\t\tif (hasAnnounceOk(this.version)) {\n\t\t\t\tconst ok = await AnnounceOk.decode(stream.reader, this.version);\n\t\t\t\tresponderOrigin = ok.origin;\n\t\t\t}\n\n\t\t\tswitch (this.version) {\n\t\t\t\tcase Version.DRAFT_01:\n\t\t\t\tcase Version.DRAFT_02: {\n\t\t\t\t\t// Receive ANNOUNCE_INIT first\n\t\t\t\t\tconst init = await AnnounceInit.decode(stream.reader, this.version);\n\n\t\t\t\t\t// Process initial announcements\n\t\t\t\t\tfor (const suffix of init.suffixes) {\n\t\t\t\t\t\tconst path = Path.join(prefix, suffix);\n\t\t\t\t\t\tconsole.debug(`announced: broadcast=${path} active=true`);\n\t\t\t\t\t\tannounced.append({ path: suffix, active: true });\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\t// Draft03+: no AnnounceInit, initial state comes via Announce messages.\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Lite06+: announce ids. Each received `active` implicitly assigns the next\n\t\t\t// per-stream ordinal; `endedId`/`restart` reference it. Tracked even for\n\t\t\t// announces we skip via ignoreSelf, since the sender doesn't know we skipped.\n\t\t\tlet nextAnnounceId = 0n;\n\t\t\tconst announcedById = new Map<bigint, Path.Valid>();\n\n\t\t\t// Receive announce updates (for Draft03, this includes initial state)\n\t\t\tfor (;;) {\n\t\t\t\tconst announce = await Promise.race([\n\t\t\t\t\tdecodeAnnounceBroadcastMaybe(stream.reader, this.version),\n\t\t\t\t\tannounced.closed,\n\t\t\t\t]);\n\t\t\t\t// undefined: the stream ended. null: the consumer closed cleanly.\n\t\t\t\tif (!announce) break;\n\t\t\t\tif (announce instanceof Error) throw announce;\n\n\t\t\t\tlet suffix: Path.Valid;\n\t\t\t\tlet active: boolean;\n\t\t\t\t// Present on active/restart; ended messages never carry hops worth checking.\n\t\t\t\tlet hops: Origin[] | undefined;\n\n\t\t\t\tswitch (announce.status) {\n\t\t\t\t\tcase \"active\":\n\t\t\t\t\t\tsuffix = announce.suffix;\n\t\t\t\t\t\tactive = true;\n\t\t\t\t\t\thops = announce.hops;\n\t\t\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\t\t\tannouncedById.set(nextAnnounceId++, announce.suffix);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"ended\":\n\t\t\t\t\t\tsuffix = announce.suffix;\n\t\t\t\t\t\tactive = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"endedId\": {\n\t\t\t\t\t\t// Resolve and retire the id; an unknown or retired id is a protocol violation.\n\t\t\t\t\t\tconst path = announcedById.get(announce.id);\n\t\t\t\t\t\tif (path === undefined) throw new Error(`unknown announce id: ${announce.id}`);\n\t\t\t\t\t\tannouncedById.delete(announce.id);\n\t\t\t\t\t\tsuffix = path;\n\t\t\t\t\t\tactive = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"restart\": {\n\t\t\t\t\t\t// Resolve the id; it stays live (the replacement reuses it).\n\t\t\t\t\t\tconst path = announcedById.get(announce.id);\n\t\t\t\t\t\tif (path === undefined) throw new Error(`unknown announce id: ${announce.id}`);\n\t\t\t\t\t\tsuffix = path;\n\t\t\t\t\t\tactive = true;\n\t\t\t\t\t\thops = announce.hops;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Optionally drop reflected announces so callers asking for\n\t\t\t\t// \"someone else's broadcasts\" don't re-see their own publishes. In\n\t\t\t\t// Lite05+ the sender's origin arrives via AnnounceOk, not in each hop\n\t\t\t\t// list, so fold it back in before checking.\n\t\t\t\tif (hops !== undefined && options.ignoreSelf) {\n\t\t\t\t\tconst full = responderOrigin !== undefined ? [...hops, responderOrigin] : hops;\n\t\t\t\t\tif (full.includes(this.origin)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst path = Path.join(prefix, suffix);\n\n\t\t\t\tconsole.debug(`announced: broadcast=${path} active=${active}`);\n\t\t\t\tannounced.append({ path: suffix, active });\n\t\t\t}\n\n\t\t\tannounced.close();\n\t\t} catch (err: unknown) {\n\t\t\tannounced.close(error(err));\n\t\t}\n\t}\n\n\t/**\n\t * Consumes a broadcast from the connection.\n\t *\n\t * Deduplicated per path: repeat calls for the same still-live path share one reference-counted\n\t * broadcast (and one upstream subscription). The shared broadcast closes once every caller has\n\t * closed its handle, so callers close normally.\n\t *\n\t * @param name - The name of the broadcast to consume\n\t * @returns A Broadcast instance\n\t */\n\tconsume(path: Path.Valid): broadcast.Consumer {\n\t\treturn this.#consumes.get(path) ?? this.#consumes.insert(path, this.#createConsume(path));\n\t}\n\n\t#createConsume(path: Path.Valid): broadcast.Consumer {\n\t\t// A consumed broadcast resolves info() and fetchGroup() over the wire by reaching\n\t\t// back into this Subscriber (see ConsumeBroadcast below), rather than the wire\n\t\t// installing callbacks on the broadcast.\n\t\tconst consumer = new ConsumeBroadcast(this, path);\n\n\t\tvoid (async () => {\n\t\t\tfor (;;) {\n\t\t\t\tconst request = await consumer.requested();\n\t\t\t\tif (!request) break;\n\t\t\t\tvoid this.#runSubscribe(path, request);\n\t\t\t}\n\t\t})();\n\n\t\treturn consumer;\n\t}\n\n\tasync #runSubscribe(broadcast: Path.Valid, request: track.Request) {\n\t\tconst id = this.#subscribeNext++;\n\n\t\t// `timescale` stays undefined until TRACK_INFO (or, on older drafts,\n\t\t// implicit defaults) resolves it; runGroup blocks on it before decoding.\n\t\tconst timescale = new Signal<number | undefined>(undefined);\n\n\t\tconsole.debug(`subscribe start: id=${id} broadcast=${broadcast} track=${request.name}`);\n\n\t\tconst msg = new Subscribe({ id, broadcast, track: request.name, priority: request.priority });\n\n\t\t// Open the stream under a timeout. The stream handle flows back via `state`\n\t\t// so the timeout path can abort it if it finishes opening after the deadline.\n\t\tconst state: { stream?: Stream } = {};\n\t\tconst setup = this.#openSubscribe(state, msg, request, id, timescale);\n\n\t\tlet opened: { stream: Stream; producer: track.Producer };\n\t\ttry {\n\t\t\topened = await withTimeout(\n\t\t\t\tsetup,\n\t\t\t\tSUBSCRIBE_SETUP_TIMEOUT_MS,\n\t\t\t\t`subscribe timed out after ${SUBSCRIBE_SETUP_TIMEOUT_MS}ms waiting for the first response (browser stream limit reached?)`,\n\t\t\t);\n\t\t\tconsole.debug(`subscribe ok: id=${id} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\tconst e = error(err);\n\t\t\trequest.reject(e);\n\t\t\tthis.#subscribes.delete(id);\n\t\t\tconsole.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request.name} error=${reason(e)}`);\n\t\t\t// If the stream eventually opens after the timeout, abort it so we\n\t\t\t// don't leak it. Cover both branches: setup may resolve late, or it\n\t\t\t// may reject (e.g. encode/decode failure) after the stream is open.\n\t\t\tsetup.then(\n\t\t\t\t() => state.stream?.abort(e),\n\t\t\t\t() => state.stream?.abort(e),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst { stream, producer } = opened;\n\t\ttry {\n\t\t\t// Watch for priority changes and send SUBSCRIBE_UPDATE. Lite01/Lite02\n\t\t\t// don't carry SUBSCRIBE_UPDATE on the wire, so skip the watcher there\n\t\t\t// and just wait on the stream/track like before.\n\t\t\t//\n\t\t\t// On lite-05+ the publisher sends SUBSCRIBE_START/END/DROP on this stream;\n\t\t\t// drain them (we don't drive delivery off the resolved range) so the FIN is\n\t\t\t// observed. Older drafts just wait for the stream to close.\n\t\t\tconst closed = supportsTrackStream(this.version) ? this.#drainResponses(stream) : stream.reader.closed;\n\t\t\tconst priorityUpdates =\n\t\t\t\tthis.version === Version.DRAFT_01 || this.version === Version.DRAFT_02\n\t\t\t\t\t? undefined\n\t\t\t\t\t: this.#runPriorityUpdates(id, broadcast, producer, msg, stream);\n\n\t\t\t// Terminal conditions (stream end, track close, a failed priority update) settle at most\n\t\t\t// once; race them into one stable promise so the demand loop doesn't re-subscribe each pass.\n\t\t\tconst terminal: PromiseLike<unknown>[] = [closed, producer.closed];\n\t\t\tif (priorityUpdates !== undefined) terminal.push(priorityUpdates);\n\t\t\tconst done = Promise.race(terminal);\n\n\t\t\t// Serve until a terminal condition fires or the last local subscriber leaves. The unused\n\t\t\t// wake is level-triggered: re-check demand so a subscriber that returns before we tear\n\t\t\t// down (e.g. a quickly unmuted tile) resumes on the same subscription.\n\t\t\tconst idle = Symbol(\"idle\");\n\t\t\tfor (;;) {\n\t\t\t\tconst reason = await Promise.race([done, producer.unused().then(() => idle)]);\n\t\t\t\tif (reason === idle && producer.closed.peek() === undefined && producer.used.peek()) continue;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tproducer.close();\n\t\t\tstream.close();\n\t\t\tconsole.debug(`subscribe close: id=${id} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\tconst e = error(err);\n\t\t\tproducer.close(e);\n\t\t\tconsole.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request.name} error=${reason(e)}`);\n\t\t\tstream.abort(e);\n\t\t} finally {\n\t\t\tthis.#subscribes.delete(id);\n\t\t}\n\t}\n\n\t// Determine the track's immutable properties, accept the request (so the\n\t// application's track.Subscriber resolves and incoming groups have a producer to\n\t// write into), register it, then open the subscribe stream. `state.stream` is\n\t// populated as soon as the subscribe stream opens so the caller can clean it up\n\t// on timeout even before this promise settles.\n\t//\n\t// On lite-05+ the properties come from a TRACK stream opened first, and the\n\t// SUBSCRIBE is accepted implicitly (no SUBSCRIBE_OK). Older drafts carry no\n\t// per-track properties, so they resolve to defaults and just drain SUBSCRIBE_OK.\n\tasync #openSubscribe(\n\t\tstate: { stream?: Stream },\n\t\tmsg: Subscribe,\n\t\trequest: track.Request,\n\t\tid: bigint,\n\t\ttimescale: Signal<number | undefined>,\n\t): Promise<{ stream: Stream; producer: track.Producer }> {\n\t\tlet producer: track.Producer;\n\t\tlet drainOk = false;\n\n\t\tif (supportsTrackStream(this.version)) {\n\t\t\t// Fetch the immutable properties once via the TRACK stream.\n\t\t\tconst info = await this.#trackInfo(msg.broadcast, msg.track);\n\t\t\tproducer = request.accept(this.#toModelInfo(info));\n\t\t\ttimescale.set(info.timescale);\n\t\t} else {\n\t\t\t// Older drafts negotiate nothing per-track: verbatim frames, no timescale.\n\t\t\tproducer = request.accept();\n\t\t\ttimescale.set(0);\n\t\t\tdrainOk = true;\n\t\t}\n\n\t\t// Register before opening SUBSCRIBE so a racing GROUP stream finds the entry.\n\t\tthis.#subscribes.set(id, { track: producer, timescale });\n\n\t\tstate.stream = await Stream.open(this.#quic);\n\t\tawait state.stream.writer.u53(StreamId.Subscribe);\n\t\tawait msg.encode(state.stream.writer, this.version);\n\n\t\tif (drainOk) {\n\t\t\t// The first response MUST be a SUBSCRIBE_OK (older drafts only).\n\t\t\tconst resp = await decodeSubscribeResponse(state.stream.reader, this.version);\n\t\t\tif (!(\"ok\" in resp)) {\n\t\t\t\tthrow new Error(\"first subscribe response must be SUBSCRIBE_OK\");\n\t\t\t}\n\t\t}\n\n\t\treturn { stream: state.stream, producer };\n\t}\n\n\t// Opens a TRACK stream, reads the single TRACK_INFO, and FINs. Lite-05+ only.\n\tasync #trackInfo(broadcast: Path.Valid, track: string): Promise<TrackInfo> {\n\t\tconst stream = await Stream.open(this.#quic);\n\t\ttry {\n\t\t\tawait stream.writer.u53(StreamId.Track);\n\t\t\tawait new TrackMessage(broadcast, track).encode(stream.writer, this.version);\n\t\t\tconst info = await TrackInfo.decode(stream.reader, this.version);\n\t\t\t// The publisher FINs after TRACK_INFO; FIN our side too.\n\t\t\tstream.close();\n\t\t\treturn info;\n\t\t} catch (err) {\n\t\t\tstream.abort(error(err));\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// Map the wire TRACK_INFO onto the model track.Info a producer/consumer holds.\n\t#toModelInfo(info: TrackInfo): track.Info {\n\t\treturn {\n\t\t\ttimescale: Time.Timescale(info.timescale),\n\t\t\t// Publisher Max Latency rides on the wire, so the local retention window\n\t\t\t// matches what the upstream advertises (relays re-serve with the same bound).\n\t\t\tlatencyMax: info.latencyMax,\n\t\t\tpriority: info.priority,\n\t\t\tordered: info.ordered,\n\t\t};\n\t}\n\n\t// Resolve a track's immutable model info via a TRACK stream (lite-05+), for the\n\t// ConsumeBroadcast backing track.Consumer.info(). On older drafts there's no TRACK\n\t// stream, so this rejects rather than fabricating defaults.\n\tasync resolveTrackInfo(broadcast: Path.Valid, track: string): Promise<track.Info> {\n\t\tif (!supportsTrackStream(this.version)) {\n\t\t\tthrow new Error(\"track info requires moq-lite-05 or newer\");\n\t\t}\n\t\treturn this.#toModelInfo(await this.#trackInfo(broadcast, track));\n\t}\n\n\t// Open a FETCH stream for one group and stream its bare frames into a group, for the\n\t// ConsumeBroadcast backing track.Consumer.fetchGroup() (lite-05+).\n\tfetchGroup(\n\t\tbroadcast: Path.Valid,\n\t\ttrack: string,\n\t\tsequence: number,\n\t\toptions: track.FetchGroupOptions = {},\n\t): Promise<netGroup.Consumer> {\n\t\t// Coalesce onto a still-open fetch of the same group so we don't open a second FETCH\n\t\t// stream (and re-download it); each caller reads an independent mirror.\n\t\tconst key = JSON.stringify([broadcast, track, sequence]);\n\t\tconst existing = this.#fetches.get(key);\n\t\tif (existing && !existing.isClosed) return Promise.resolve(existing.mirror());\n\n\t\t// Create and cache the group synchronously (before any await) so a concurrent fetch for\n\t\t// the same group finds it and coalesces rather than racing to open its own stream.\n\t\tconst group = new netGroup.Producer(sequence);\n\t\tthis.#fetches.set(key, group);\n\t\tvoid group.closed.then(() => {\n\t\t\tif (this.#fetches.get(key) === group) this.#fetches.delete(key);\n\t\t});\n\n\t\treturn this.#runFetch(broadcast, track, sequence, options, group);\n\t}\n\n\t// Open the FETCH stream and pump the response into the shared group. Setup errors close the\n\t// group (so coalesced mirrors observe them and the entry evicts) and reject this caller.\n\tasync #runFetch(\n\t\tbroadcast: Path.Valid,\n\t\ttrack: string,\n\t\tsequence: number,\n\t\toptions: track.FetchGroupOptions,\n\t\tgroup: netGroup.Producer,\n\t): Promise<netGroup.Consumer> {\n\t\ttry {\n\t\t\tif (!supportsTrackStream(this.version)) {\n\t\t\t\tthrow new Error(\"fetch group requires moq-lite-05 or newer\");\n\t\t\t}\n\n\t\t\tconst info = await this.#trackInfo(broadcast, track);\n\t\t\tconst priority = options.priority ?? 0;\n\t\t\tconst stream = await Stream.open(this.#quic, undefined, priority);\n\n\t\t\ttry {\n\t\t\t\tawait stream.writer.u53(StreamId.Fetch);\n\t\t\t\tawait new FetchMessage(broadcast, track, priority, sequence).encode(stream.writer, this.version);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tstream.abort(error(err));\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\t// Mint this caller's reader before starting the pump, so the group has demand when the\n\t\t\t// pump begins watching it (an abandoned fetch cancels once every reader has left).\n\t\t\tconst consumer = group.mirror();\n\t\t\tvoid this.#runFetchResponse(stream, group, Time.Timescale(info.timescale));\n\t\t\treturn consumer;\n\t\t} catch (err: unknown) {\n\t\t\tgroup.close(error(err));\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// Read the FETCH response (bare zigzag-delta-timestamped frames) into the group, then\n\t// FIN. A stream-level failure aborts the group so its reader observes the gap.\n\tasync #runFetchResponse(stream: Stream, group: netGroup.Producer, timescale: Time.Timescale): Promise<void> {\n\t\ttry {\n\t\t\tlet prevTs = 0n;\n\n\t\t\t// Serve until the stream FINs, the group closes, or every reader leaves. A group can\n\t\t\t// stay open indefinitely (a catalog or JSON stream), so an abandoned fetch is stopped by\n\t\t\t// demand, not by the stream ending. `closed` and `unused` are watched across frames as\n\t\t\t// stable promises (not re-subscribed to the signals each frame); the unused check is\n\t\t\t// level-triggered, so a coalesced fetch that arrives before we cancel re-arms and resumes.\n\t\t\tconst idle = Symbol(\"idle\");\n\t\t\tconst closed = Promise.resolve<Error | null>(group.closed);\n\t\t\tlet unused = group.unused().then(() => idle);\n\t\t\tfor (;;) {\n\t\t\t\tconst done = await Promise.race([stream.reader.done(), closed, unused]);\n\t\t\t\tif (done === idle) {\n\t\t\t\t\tif (!group.isClosed && group.used.peek()) {\n\t\t\t\t\t\tunused = group.unused().then(() => idle);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (done !== false) break;\n\n\t\t\t\tprevTs += unzigzag(await stream.reader.u62());\n\t\t\t\tconst timestamp = new Time.Timestamp(Number(prevTs), timescale);\n\t\t\t\tconst size = await stream.reader.u53();\n\t\t\t\tconst payload = await stream.reader.read(size);\n\t\t\t\tif (!payload) break;\n\t\t\t\tgroup.writeFrame({ payload, timestamp });\n\t\t\t}\n\n\t\t\tgroup.close();\n\t\t\tstream.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tgroup.close(e);\n\t\t\tstream.abort(e);\n\t\t}\n\t}\n\n\t// Drains SUBSCRIBE_START/END/DROP on the subscribe stream until FIN (lite-05+).\n\t// The resolved range is informational here; the producer already orders groups.\n\t// Resolves (never rejects) on FIN or on the stream being reset out from under it,\n\t// so it's safe to drop from a Promise.race without an unhandled rejection.\n\tasync #drainResponses(stream: Stream): Promise<void> {\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst resp = await decodeSubscribeResponseMaybe(stream.reader, this.version);\n\t\t\t\tif (!resp) return;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Stream closed or reset; nothing more to drain.\n\t\t}\n\t}\n\n\t/**\n\t * Send SUBSCRIBE_UPDATE messages whenever the track's priority signal changes.\n\t *\n\t * Resolves cleanly when the stream or track closes, so the caller can include\n\t * this in Promise.race without leaving a dangling pending write that would\n\t * become an unhandled rejection if the user calls updatePriority after close.\n\t *\n\t * Peeks the signal at the top of every iteration so that updates which landed\n\t * before SubscribeOk arrived (or between iterations, before .next() registered\n\t * its listener) aren't lost.\n\t */\n\tasync #runPriorityUpdates(\n\t\tid: bigint,\n\t\tbroadcast: Path.Valid,\n\t\ttrack: track.Producer,\n\t\tmsg: Subscribe,\n\t\tstream: Stream,\n\t): Promise<void> {\n\t\tconst stopped: Promise<null> = Promise.race([track.closed, stream.reader.closed]).then(() => null);\n\t\tlet lastSent: number | undefined;\n\n\t\tfor (;;) {\n\t\t\tconst current = track.subscription.peek()?.priority;\n\t\t\tif (current === undefined || current === lastSent) {\n\t\t\t\t// Nothing new to send; wait for a change or termination.\n\t\t\t\tconst next = await Promise.race([track.subscription.changed(), stopped]);\n\t\t\t\tif (next === null) return;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Round-trip the other Subscribe parameters so the publisher doesn't\n\t\t\t// interpret SUBSCRIBE_UPDATE as a reset of ordered/maxLatency/etc.\n\t\t\tconst update = new SubscribeUpdate({\n\t\t\t\tpriority: current,\n\t\t\t\tordered: msg.ordered,\n\t\t\t\tmaxLatency: msg.maxLatency,\n\t\t\t\tstartGroup: msg.startGroup,\n\t\t\t\tendGroup: msg.endGroup,\n\t\t\t});\n\t\t\tawait update.encode(stream.writer, this.version);\n\t\t\tlastSent = current;\n\t\t\tconsole.debug(`subscribe update: id=${id} broadcast=${broadcast} track=${track.name} priority=${current}`);\n\t\t}\n\t}\n\n\t/**\n\t * Handles a group message.\n\t * @param group - The group message\n\t * @param stream - The stream to read frames from\n\t *\n\t * @internal\n\t */\n\tasync runGroup(group: GroupMessage, stream: Reader) {\n\t\tconst entry = this.#subscribes.get(group.subscribe);\n\t\tif (!entry) {\n\t\t\tif (group.subscribe >= this.#subscribeNext) {\n\t\t\t\tthrow new Error(`unknown subscription: id=${group.subscribe}`);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst { track, timescale } = entry;\n\t\tconst producer = new netGroup.Producer(group.sequence);\n\t\ttrack.writeGroup(producer);\n\n\t\ttry {\n\t\t\t// Block until the timescale is known; the group's stream can arrive before\n\t\t\t// TRACK_INFO (or implicit defaults) resolves it on the subscribe stream.\n\t\t\tlet scale = timescale.peek();\n\t\t\twhile (scale === undefined) {\n\t\t\t\tif (track.closed.peek() !== undefined) {\n\t\t\t\t\t// Subscription ended before the scale resolved; nothing to decode.\n\t\t\t\t\tproducer.close();\n\t\t\t\t\tstream.stop(new Error(\"cancel\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tawait Signal.race(timescale, track.closed);\n\t\t\t\tscale = timescale.peek();\n\t\t\t}\n\n\t\t\t// A non-zero scale means every frame is prefixed with a zigzag-delta timestamp\n\t\t\t// (the lite-05 FRAME format), which we decode into a Timestamp at that scale.\n\t\t\t// Scale 0 (pre-lite-05) carries no timestamp, so we wall-clock-stamp.\n\t\t\tlet prevTs = 0n;\n\n\t\t\tfor (;;) {\n\t\t\t\tconst done = await Promise.race([stream.done(), track.closed, producer.closed]);\n\t\t\t\tif (done !== false) break;\n\n\t\t\t\tlet timestamp: Time.Timestamp;\n\t\t\t\tif (scale !== 0) {\n\t\t\t\t\tprevTs += unzigzag(await stream.u62());\n\t\t\t\t\ttimestamp = new Time.Timestamp(Number(prevTs), Time.Timescale(scale));\n\t\t\t\t} else {\n\t\t\t\t\ttimestamp = Time.Timestamp.now();\n\t\t\t\t}\n\n\t\t\t\tconst size = await stream.u53();\n\t\t\t\tconst payload = await stream.read(size);\n\t\t\t\tif (!payload) break;\n\n\t\t\t\tproducer.writeFrame({ payload, timestamp });\n\t\t\t}\n\n\t\t\tproducer.close();\n\t\t\tstream.stop(new Error(\"cancel\"));\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tproducer.close(e);\n\t\t\tstream.stop(e);\n\t\t}\n\t}\n\n\t/**\n\t * Receives QUIC datagrams and routes each to its subscription's track producer (lite-05 §6.4).\n\t *\n\t * Returns immediately on a non-datagram transport or pre-lite-05 version. A decode error or an\n\t * unknown subscribe id drops that datagram without tearing down the session (best-effort); the\n\t * loop ends only when the datagram stream closes.\n\t *\n\t * @internal\n\t */\n\tasync runDatagrams(): Promise<void> {\n\t\tif (!hasDatagrams(this.version) || DatagramStream.maxDatagramSize(this.#quic) === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Never reject: this loop is awaited alongside the connection's other tasks, so a\n\t\t// datagram-stream failure must not tear the whole session down (it's best-effort).\n\t\tconst reader = DatagramStream.datagramReader(this.#quic);\n\t\tif (!reader) return;\n\n\t\ttry {\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst { value, done } = await reader.read();\n\t\t\t\t\tif (done) break;\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.#routeDatagram(value);\n\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\tconsole.debug(`dropping datagram: ${reason(err)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\treader.releaseLock();\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tif (e.message === \"The session is closed.\") {\n\t\t\t\tconsole.debug(`datagram receive stopped: ${e.message}`);\n\t\t\t} else {\n\t\t\t\tconsole.warn(\"datagram stream error\", err);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Decode one datagram body and hand it to the matching subscription's producer. Drops the\n\t// datagram (best-effort) if the subscription is unknown/closed or its timescale isn't resolved.\n\tasync #routeDatagram(payload: Uint8Array): Promise<void> {\n\t\tconst dg = await DatagramMessage.decode(payload);\n\n\t\tconst entry = this.#subscribes.get(dg.subscribe);\n\t\tif (!entry) return; // Unknown or already-closed subscription.\n\n\t\t// Datagrams are lite-05+, which always negotiates a timescale; if it hasn't resolved\n\t\t// yet (the datagram raced ahead of TRACK_INFO), drop rather than guess.\n\t\tconst scale = entry.timescale.peek();\n\t\tif (!scale) return;\n\n\t\tconst timestamp = new Time.Timestamp(dg.timestamp, Time.Timescale(scale));\n\t\tentry.track.writeDatagram({ sequence: dg.sequence, timestamp, payload: dg.payload });\n\t}\n\n\t/**\n\t * Opens a PROBE bidi stream to receive bandwidth estimates from the publisher.\n\t * Returns immediately if recv bandwidth is not supported.\n\t *\n\t * Probe is best-effort telemetry: a stream-level failure (peer reset, FIN,\n\t * missing peer support, transport hiccup) is caught and logged, never\n\t * propagated to the connection. On exit the bandwidth/RTT signals are\n\t * cleared so consumers see them as stale.\n\t *\n\t * @internal\n\t */\n\t// Await the peer's advertised probe level, blocking until its SETUP arrives. The peer\n\t// MUST send exactly one SETUP, so this resolves once that stream is read.\n\tasync #peerProbeLevel(peerSetup: Signal<Setup | undefined>): Promise<ProbeLevel> {\n\t\tlet setup = peerSetup.peek();\n\t\twhile (setup === undefined) {\n\t\t\tsetup = await peerSetup.changed();\n\t\t}\n\t\treturn setup.probe;\n\t}\n\n\tasync runProbe(): Promise<void> {\n\t\tif (!this.#probe) return;\n\t\tif (this.version === Version.DRAFT_01 || this.version === Version.DRAFT_02) return;\n\n\t\t// Lite-05+ gates the PROBE stream on the peer advertising Probe >= Report in its\n\t\t// SETUP. Wait for the SETUP, then bail if the peer can't report bitrate. Older\n\t\t// drafts have no SETUP, so they keep probing unconditionally.\n\t\tif (this.#peerSetup) {\n\t\t\tconst probe = await this.#peerProbeLevel(this.#peerSetup);\n\t\t\tif (probe < ProbeLevel.Report) return;\n\t\t}\n\n\t\t// Probe is best-effort: any failure (stream reset by peer, missing peer support,\n\t\t// transport hiccup) MUST NOT tear down the connection. On error, drop the\n\t\t// estimates so consumers know they're stale.\n\t\ttry {\n\t\t\tconst stream = await Stream.open(this.#quic);\n\t\t\tawait stream.writer.u53(StreamId.Probe);\n\n\t\t\tfor (;;) {\n\t\t\t\tconst probe = await Probe.decodeMaybe(stream.reader, this.version);\n\t\t\t\tif (!probe) break;\n\t\t\t\t// A message that omits the RTT leaves the last one standing, so a\n\t\t\t\t// bitrate-only report doesn't blank it.\n\t\t\t\tconst prev = this.#probe.peek();\n\t\t\t\tthis.#probe.set({\n\t\t\t\t\testimatedRecvRate: probe.bitrate ?? undefined,\n\t\t\t\t\trtt: probe.rtt !== undefined ? Time.Milli(probe.rtt) : prev.rtt,\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tif (!this.#closed.signal.aborted) {\n\t\t\t\tconsole.warn(\"probe stream error\", err);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.#probe.set({});\n\t\t}\n\t}\n\n\tclose() {\n\t\tthis.#closed.abort();\n\n\t\tfor (const { track } of this.#subscribes.values()) {\n\t\t\ttrack.close();\n\t\t}\n\n\t\tthis.#subscribes.clear();\n\t}\n}\n\n/**\n * A broadcast consumed from a lite session. It resolves `track.Consumer.info()` and\n * `.fetchGroup()` over the wire (lite-05+ TRACK / FETCH streams) by reaching into the\n * {@link Subscriber} it was opened from, the way the Rust `BroadcastConsumer` holds its\n * session. Live subscribes still flow through the inherited requested() queue.\n */\nclass ConsumeBroadcast extends broadcast.Consumer {\n\t#subscriber: Subscriber;\n\t#path: Path.Valid;\n\n\tconstructor(subscriber: Subscriber, path: Path.Valid, state?: never) {\n\t\tsuper(state);\n\t\tthis.#subscriber = subscriber;\n\t\tthis.#path = path;\n\t}\n\n\t// Preserve the subclass (and its wire-backed info/fetchGroup) when the consume cache shares\n\t// this broadcast across callers.\n\toverride clone(): ConsumeBroadcast {\n\t\treturn new ConsumeBroadcast(this.#subscriber, this.#path, this.shareState());\n\t}\n\n\toverride resolveTrackInfo(name: string): Promise<track.Info> {\n\t\treturn this.#subscriber.resolveTrackInfo(this.#path, name);\n\t}\n\n\toverride fetchGroup(name: string, sequence: number, options?: track.FetchGroupOptions): Promise<netGroup.Consumer> {\n\t\treturn this.#subscriber.fetchGroup(this.#path, name, sequ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B,KAAK,CAAa;IAElB,YAAY,UAAsB,EAAE,IAAgB,EAAE,KAAa;QAClE,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,4FAA4F;IAC5F,iCAAiC;IACxB,KAAK;QACb,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9E,CAAC;IAEQ,gBAAgB,CAAC,IAAY;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;IAEQ,UAAU,CAAC,IAAY,EAAE,QAAgB,EAAE,OAAiC;QACpF,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["import { Signal } from \"@moq/signals\";\nimport * as announce from \"../announced.ts\";\nimport * as broadcast from \"../broadcast.ts\";\nimport type { Probe as ProbeStats } from \"../connection/stats.ts\";\nimport { BroadcastCache } from \"../consume.ts\";\nimport { error, reason } from \"../error.ts\";\nimport * as netGroup from \"../group.ts\";\nimport * as Path from \"../path.ts\";\nimport { type Reader, Stream } from \"../stream.ts\";\nimport * as Time from \"../time.ts\";\nimport type * as track from \"../track.ts\";\nimport { withTimeout } from \"../util/timeout.ts\";\nimport { AnnounceInit, AnnounceOk, AnnounceRequest, decodeAnnounceBroadcastMaybe } from \"./announce.ts\";\nimport { Datagram as DatagramMessage } from \"./datagram.ts\";\nimport * as DatagramStream from \"./datagram_stream.ts\";\nimport { Fetch as FetchMessage } from \"./fetch.ts\";\nimport type { Group as GroupMessage } from \"./group.ts\";\nimport type { Origin } from \"./origin.ts\";\nimport { Probe } from \"./probe.ts\";\nimport { ProbeLevel, type Setup } from \"./setup.ts\";\nimport { StreamId } from \"./stream.ts\";\nimport { decodeSubscribeResponse, decodeSubscribeResponseMaybe, Subscribe, SubscribeUpdate } from \"./subscribe.ts\";\nimport { TrackInfo, Track as TrackMessage } from \"./track.ts\";\nimport { hasAnnounceId, hasAnnounceOk, hasDatagrams, Version } from \"./version.ts\";\n\n// Bound on how long stream-open plus the first response (SUBSCRIBE_OK on older\n// drafts, or TRACK_INFO on lite-05+) may take. Browsers cap concurrent QUIC\n// streams (Chrome ~100); past the cap createBidirectionalStream silently blocks.\n// The timeout turns that into a clear error.\nconst SUBSCRIBE_SETUP_TIMEOUT_MS = 10_000;\n\n/** Decode an unsigned zigzag varint back to a signed delta (mirrors Rust `VarInt::to_zigzag`). */\nfunction unzigzag(v: bigint): bigint {\n\treturn (v >> 1n) ^ -(v & 1n);\n}\n\n// The TRACK stream and implicit SUBSCRIBE acceptance are lite-05+.\nfunction supportsTrackStream(version: Version): boolean {\n\tswitch (version) {\n\t\tcase Version.DRAFT_01:\n\t\tcase Version.DRAFT_02:\n\t\tcase Version.DRAFT_03:\n\t\tcase Version.DRAFT_04:\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n\n/**\n * Options accepted by {@link Subscriber.announced}.\n */\nexport interface AnnouncedOptions {\n\t/**\n\t * If true, skip announcements whose hop chain contains this connection's\n\t * own origin id. Useful for meshes that reflect announces back. Defaults\n\t * to false for backwards compatibility: existing code (notably hang.live)\n\t * relies on seeing its own publishes as the signal that a namespace\n\t * published successfully.\n\t */\n\tignoreSelf?: boolean;\n}\n\ninterface SubscribeEntry {\n\t// The write side: incoming GROUP streams are routed here. The application reads\n\t// the matching track.Subscriber it got from broadcast.Consumer.subscribe.\n\ttrack: track.Producer;\n\t// Per-frame timestamp scale (0 = none). undefined until it's known (from TRACK_INFO\n\t// on lite-05+, or implicit defaults on older drafts). A non-zero value means each\n\t// frame on the group stream is prefixed with a zigzag-delta timestamp varint that\n\t// runGroup must consume to stay in sync; group streams block on it before decoding,\n\t// since a group's QUIC stream can race ahead of the subscribe stream.\n\ttimescale: Signal<number | undefined>;\n}\n\n/**\n * Handles subscribing to broadcasts and managing their lifecycle.\n *\n * @internal\n */\nexport class Subscriber {\n\t#quic: WebTransport;\n\n\t// The version of the connection.\n\treadonly version: Version;\n\n\t// Shared with the Publisher so callers can optionally filter out their\n\t// own announcements on a per-call basis (see {@link AnnouncedOptions}).\n\treadonly origin: Origin;\n\n\t// Our subscribed tracks. `timescale` resolves once known (from TRACK_INFO on\n\t// lite-05+, or implicit defaults on older drafts); group streams block on it\n\t// before decoding any frame, since a group's QUIC stream can race ahead.\n\t#subscribes = new Map<bigint, SubscribeEntry>();\n\t#subscribeNext = 0n;\n\n\t// Dedup consumed broadcasts per path: repeat consume() calls share one subscription.\n\t#consumes = new BroadcastCache();\n\n\t// Dedup in-flight one-shot fetches, keyed by [broadcast, track, sequence]. Concurrent (or\n\t// repeat, while still open) fetchGroup() calls for the same group share one FETCH stream and\n\t// each get an independent mirror; the entry is evicted once the group closes.\n\t#fetches = new Map<string, netGroup.Producer>();\n\n\t// The peer's PROBE estimates, written as they arrive (Lite03+ only).\n\t#probe?: Signal<ProbeStats>;\n\n\t// The peer's SETUP (lite-05+), undefined until it arrives. Gates opening the PROBE\n\t// stream on the peer having advertised Probe >= Report.\n\t#peerSetup?: Signal<Setup | undefined>;\n\n\t// Distinguishes failures from streams torn down by Subscriber.close().\n\t#closed = new AbortController();\n\t/**\n\t * Creates a new Subscriber instance.\n\t * @param quic - The WebTransport session to use\n\t * @param version - The protocol version\n\t * @param origin - Origin id shared with the Publisher\n\t * @param probe - Optional sink for the peer's PROBE estimates\n\t * @param peerSetup - Optional peer SETUP slot for capability gating (lite-05+)\n\t *\n\t * @internal\n\t */\n\tconstructor(\n\t\tquic: WebTransport,\n\t\tversion: Version,\n\t\torigin: Origin,\n\t\tprobe?: Signal<ProbeStats>,\n\t\tpeerSetup?: Signal<Setup | undefined>,\n\t) {\n\t\tthis.#quic = quic;\n\t\tthis.version = version;\n\t\tthis.origin = origin;\n\t\tthis.#probe = probe;\n\t\tthis.#peerSetup = peerSetup;\n\t}\n\n\t/**\n\t * Subscribe to broadcast announcements under `prefix`.\n\t *\n\t * Pass `{ ignoreSelf: true }` to skip announces that have already traversed\n\t * this connection's {@link origin}.\n\t */\n\tannounced(prefix = Path.empty(), options: AnnouncedOptions = {}): announce.Consumer {\n\t\tconst announced = new announce.Producer(prefix);\n\t\tvoid this.#runAnnounced(announced, prefix, options);\n\t\treturn announced.consume();\n\t}\n\n\tasync #runAnnounced(announced: announce.Producer, prefix: Path.Valid, options: AnnouncedOptions): Promise<void> {\n\t\tconsole.debug(`announced: prefix=${prefix}`);\n\t\t// Send our own session-level origin id so the peer can skip announces\n\t\t// whose hop chain already passed through us. Matches the Rust subscriber's\n\t\t// `exclude_hop: self.self_origin.id` in `run_announce_prefix`.\n\t\tconst msg = new AnnounceRequest(prefix, this.origin);\n\n\t\ttry {\n\t\t\t// Open a stream and send the announce interest.\n\t\t\tconst stream = await Stream.open(this.#quic);\n\t\t\tawait stream.writer.u53(StreamId.Announce);\n\t\t\tawait msg.encode(stream.writer, this.version);\n\n\t\t\t// Lite05+: the publisher reports its own origin id before any announces.\n\t\t\t// It no longer stamps itself onto each hop chain, so we append it here to\n\t\t\t// keep the ignoreSelf loop check seeing the full chain.\n\t\t\tlet responderOrigin: Origin | undefined;\n\t\t\tif (hasAnnounceOk(this.version)) {\n\t\t\t\tconst ok = await AnnounceOk.decode(stream.reader, this.version);\n\t\t\t\tresponderOrigin = ok.origin;\n\t\t\t}\n\n\t\t\tswitch (this.version) {\n\t\t\t\tcase Version.DRAFT_01:\n\t\t\t\tcase Version.DRAFT_02: {\n\t\t\t\t\t// Receive ANNOUNCE_INIT first\n\t\t\t\t\tconst init = await AnnounceInit.decode(stream.reader, this.version);\n\n\t\t\t\t\t// Process initial announcements\n\t\t\t\t\tfor (const suffix of init.suffixes) {\n\t\t\t\t\t\tconst path = Path.join(prefix, suffix);\n\t\t\t\t\t\tconsole.debug(`announced: broadcast=${path} active=true`);\n\t\t\t\t\t\tannounced.append({ path: suffix, active: true });\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\t// Draft03+: no AnnounceInit, initial state comes via Announce messages.\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Lite06+: announce ids. Each received `active` implicitly assigns the next\n\t\t\t// per-stream ordinal; `endedId`/`restart` reference it. Tracked even for\n\t\t\t// announces we skip via ignoreSelf, since the sender doesn't know we skipped.\n\t\t\tlet nextAnnounceId = 0n;\n\t\t\tconst announcedById = new Map<bigint, Path.Valid>();\n\n\t\t\t// Receive announce updates (for Draft03, this includes initial state)\n\t\t\tfor (;;) {\n\t\t\t\tconst announce = await Promise.race([\n\t\t\t\t\tdecodeAnnounceBroadcastMaybe(stream.reader, this.version),\n\t\t\t\t\tannounced.closed,\n\t\t\t\t]);\n\t\t\t\t// undefined: the stream ended. null: the consumer closed cleanly.\n\t\t\t\tif (!announce) break;\n\t\t\t\tif (announce instanceof Error) throw announce;\n\n\t\t\t\tlet suffix: Path.Valid;\n\t\t\t\tlet active: boolean;\n\t\t\t\t// Present on active/restart; ended messages never carry hops worth checking.\n\t\t\t\tlet hops: Origin[] | undefined;\n\n\t\t\t\tswitch (announce.status) {\n\t\t\t\t\tcase \"active\":\n\t\t\t\t\t\tsuffix = announce.suffix;\n\t\t\t\t\t\tactive = true;\n\t\t\t\t\t\thops = announce.hops;\n\t\t\t\t\t\tif (hasAnnounceId(this.version)) {\n\t\t\t\t\t\t\tannouncedById.set(nextAnnounceId++, announce.suffix);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"ended\":\n\t\t\t\t\t\tsuffix = announce.suffix;\n\t\t\t\t\t\tactive = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"endedId\": {\n\t\t\t\t\t\t// Resolve and retire the id; an unknown or retired id is a protocol violation.\n\t\t\t\t\t\tconst path = announcedById.get(announce.id);\n\t\t\t\t\t\tif (path === undefined) throw new Error(`unknown announce id: ${announce.id}`);\n\t\t\t\t\t\tannouncedById.delete(announce.id);\n\t\t\t\t\t\tsuffix = path;\n\t\t\t\t\t\tactive = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"restart\": {\n\t\t\t\t\t\t// Resolve the id; it stays live (the replacement reuses it).\n\t\t\t\t\t\tconst path = announcedById.get(announce.id);\n\t\t\t\t\t\tif (path === undefined) throw new Error(`unknown announce id: ${announce.id}`);\n\t\t\t\t\t\tsuffix = path;\n\t\t\t\t\t\tactive = true;\n\t\t\t\t\t\thops = announce.hops;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Optionally drop reflected announces so callers asking for\n\t\t\t\t// \"someone else's broadcasts\" don't re-see their own publishes. In\n\t\t\t\t// Lite05+ the sender's origin arrives via AnnounceOk, not in each hop\n\t\t\t\t// list, so fold it back in before checking.\n\t\t\t\tif (hops !== undefined && options.ignoreSelf) {\n\t\t\t\t\tconst full = responderOrigin !== undefined ? [...hops, responderOrigin] : hops;\n\t\t\t\t\tif (full.includes(this.origin)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst path = Path.join(prefix, suffix);\n\n\t\t\t\tconsole.debug(`announced: broadcast=${path} active=${active}`);\n\t\t\t\tannounced.append({ path: suffix, active });\n\t\t\t}\n\n\t\t\tannounced.close();\n\t\t} catch (err: unknown) {\n\t\t\tannounced.close(error(err));\n\t\t}\n\t}\n\n\t/**\n\t * Consumes a broadcast from the connection.\n\t *\n\t * Deduplicated per path: repeat calls for the same still-live path share one reference-counted\n\t * broadcast (and one upstream subscription). The shared broadcast closes once every caller has\n\t * closed its handle, so callers close normally.\n\t *\n\t * @param name - The name of the broadcast to consume\n\t * @returns A Broadcast instance\n\t */\n\tconsume(path: Path.Valid): broadcast.Consumer {\n\t\treturn this.#consumes.get(path) ?? this.#consumes.insert(path, this.#createConsume(path));\n\t}\n\n\t#createConsume(path: Path.Valid): broadcast.Consumer {\n\t\t// A consumed broadcast resolves info() and fetchGroup() over the wire by reaching\n\t\t// back into this Subscriber (see ConsumeBroadcast below), rather than the wire\n\t\t// installing callbacks on the broadcast.\n\t\tconst consumer = new ConsumeBroadcast(this, path);\n\n\t\tvoid (async () => {\n\t\t\tfor (;;) {\n\t\t\t\tconst request = await consumer.requested();\n\t\t\t\tif (!request) break;\n\t\t\t\tvoid this.#runSubscribe(path, request);\n\t\t\t}\n\t\t})();\n\n\t\treturn consumer;\n\t}\n\n\tasync #runSubscribe(broadcast: Path.Valid, request: track.Request) {\n\t\tconst id = this.#subscribeNext++;\n\n\t\t// `timescale` stays undefined until TRACK_INFO (or, on older drafts,\n\t\t// implicit defaults) resolves it; runGroup blocks on it before decoding.\n\t\tconst timescale = new Signal<number | undefined>(undefined);\n\n\t\tconsole.debug(`subscribe start: id=${id} broadcast=${broadcast} track=${request.name}`);\n\n\t\tconst msg = new Subscribe({ id, broadcast, track: request.name, priority: request.priority });\n\n\t\t// Open the stream under a timeout. The stream handle flows back via `state`\n\t\t// so the timeout path can abort it if it finishes opening after the deadline.\n\t\tconst state: { stream?: Stream } = {};\n\t\tconst setup = this.#openSubscribe(state, msg, request, id, timescale);\n\n\t\tlet opened: { stream: Stream; producer: track.Producer };\n\t\ttry {\n\t\t\topened = await withTimeout(\n\t\t\t\tsetup,\n\t\t\t\tSUBSCRIBE_SETUP_TIMEOUT_MS,\n\t\t\t\t`subscribe timed out after ${SUBSCRIBE_SETUP_TIMEOUT_MS}ms waiting for the first response (browser stream limit reached?)`,\n\t\t\t);\n\t\t\tconsole.debug(`subscribe ok: id=${id} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\tconst e = error(err);\n\t\t\trequest.reject(e);\n\t\t\tthis.#subscribes.delete(id);\n\t\t\tconsole.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request.name} error=${reason(e)}`);\n\t\t\t// If the stream eventually opens after the timeout, abort it so we\n\t\t\t// don't leak it. Cover both branches: setup may resolve late, or it\n\t\t\t// may reject (e.g. encode/decode failure) after the stream is open.\n\t\t\tsetup.then(\n\t\t\t\t() => state.stream?.abort(e),\n\t\t\t\t() => state.stream?.abort(e),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst { stream, producer } = opened;\n\t\ttry {\n\t\t\t// Watch for priority changes and send SUBSCRIBE_UPDATE. Lite01/Lite02\n\t\t\t// don't carry SUBSCRIBE_UPDATE on the wire, so skip the watcher there\n\t\t\t// and just wait on the stream/track like before.\n\t\t\t//\n\t\t\t// On lite-05+ the publisher sends SUBSCRIBE_START/END/DROP on this stream;\n\t\t\t// drain them (we don't drive delivery off the resolved range) so the FIN is\n\t\t\t// observed. Older drafts just wait for the stream to close.\n\t\t\tconst closed = supportsTrackStream(this.version) ? this.#drainResponses(stream) : stream.reader.closed;\n\t\t\tconst priorityUpdates =\n\t\t\t\tthis.version === Version.DRAFT_01 || this.version === Version.DRAFT_02\n\t\t\t\t\t? undefined\n\t\t\t\t\t: this.#runPriorityUpdates(id, broadcast, producer, msg, stream);\n\n\t\t\t// Terminal conditions (stream end, track close, a failed priority update) settle at most\n\t\t\t// once; race them into one stable promise so the demand loop doesn't re-subscribe each pass.\n\t\t\tconst terminal: PromiseLike<unknown>[] = [closed, producer.closed];\n\t\t\tif (priorityUpdates !== undefined) terminal.push(priorityUpdates);\n\t\t\tconst done = Promise.race(terminal);\n\n\t\t\t// Serve until a terminal condition fires or the last local subscriber leaves. The unused\n\t\t\t// wake is level-triggered: re-check demand so a subscriber that returns before we tear\n\t\t\t// down (e.g. a quickly unmuted tile) resumes on the same subscription.\n\t\t\tconst idle = Symbol(\"idle\");\n\t\t\tfor (;;) {\n\t\t\t\tconst reason = await Promise.race([done, producer.unused().then(() => idle)]);\n\t\t\t\tif (reason === idle && producer.closed.peek() === undefined && producer.used.peek()) continue;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tproducer.close();\n\t\t\tstream.close();\n\t\t\tconsole.debug(`subscribe close: id=${id} broadcast=${broadcast} track=${request.name}`);\n\t\t} catch (err) {\n\t\t\tconst e = error(err);\n\t\t\tproducer.close(e);\n\t\t\tconsole.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request.name} error=${reason(e)}`);\n\t\t\tstream.abort(e);\n\t\t} finally {\n\t\t\tthis.#subscribes.delete(id);\n\t\t}\n\t}\n\n\t// Determine the track's immutable properties, accept the request (so the\n\t// application's track.Subscriber resolves and incoming groups have a producer to\n\t// write into), register it, then open the subscribe stream. `state.stream` is\n\t// populated as soon as the subscribe stream opens so the caller can clean it up\n\t// on timeout even before this promise settles.\n\t//\n\t// On lite-05+ the properties come from a TRACK stream opened first, and the\n\t// SUBSCRIBE is accepted implicitly (no SUBSCRIBE_OK). Older drafts carry no\n\t// per-track properties, so they resolve to defaults and just drain SUBSCRIBE_OK.\n\tasync #openSubscribe(\n\t\tstate: { stream?: Stream },\n\t\tmsg: Subscribe,\n\t\trequest: track.Request,\n\t\tid: bigint,\n\t\ttimescale: Signal<number | undefined>,\n\t): Promise<{ stream: Stream; producer: track.Producer }> {\n\t\tlet producer: track.Producer;\n\t\tlet drainOk = false;\n\n\t\tif (supportsTrackStream(this.version)) {\n\t\t\t// Fetch the immutable properties once via the TRACK stream.\n\t\t\tconst info = await this.#trackInfo(msg.broadcast, msg.track);\n\t\t\tproducer = request.accept(this.#toModelInfo(info));\n\t\t\ttimescale.set(info.timescale);\n\t\t} else {\n\t\t\t// Older drafts negotiate nothing per-track: verbatim frames, no timescale.\n\t\t\tproducer = request.accept();\n\t\t\ttimescale.set(0);\n\t\t\tdrainOk = true;\n\t\t}\n\n\t\t// Register before opening SUBSCRIBE so a racing GROUP stream finds the entry.\n\t\tthis.#subscribes.set(id, { track: producer, timescale });\n\n\t\tstate.stream = await Stream.open(this.#quic);\n\t\tawait state.stream.writer.u53(StreamId.Subscribe);\n\t\tawait msg.encode(state.stream.writer, this.version);\n\n\t\tif (drainOk) {\n\t\t\t// The first response MUST be a SUBSCRIBE_OK (older drafts only).\n\t\t\tconst resp = await decodeSubscribeResponse(state.stream.reader, this.version);\n\t\t\tif (!(\"ok\" in resp)) {\n\t\t\t\tthrow new Error(\"first subscribe response must be SUBSCRIBE_OK\");\n\t\t\t}\n\t\t}\n\n\t\treturn { stream: state.stream, producer };\n\t}\n\n\t// Opens a TRACK stream, reads the single TRACK_INFO, and FINs. Lite-05+ only.\n\tasync #trackInfo(broadcast: Path.Valid, track: string): Promise<TrackInfo> {\n\t\tconst stream = await Stream.open(this.#quic);\n\t\ttry {\n\t\t\tawait stream.writer.u53(StreamId.Track);\n\t\t\tawait new TrackMessage(broadcast, track).encode(stream.writer, this.version);\n\t\t\tconst info = await TrackInfo.decode(stream.reader, this.version);\n\t\t\t// The publisher FINs after TRACK_INFO; FIN our side too.\n\t\t\tstream.close();\n\t\t\treturn info;\n\t\t} catch (err) {\n\t\t\tstream.abort(error(err));\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// Map the wire TRACK_INFO onto the model track.Info a producer/consumer holds.\n\t#toModelInfo(info: TrackInfo): track.Info {\n\t\treturn {\n\t\t\ttimescale: Time.Timescale(info.timescale),\n\t\t\t// Publisher Max Latency rides on the wire, so the local retention window\n\t\t\t// matches what the upstream advertises (relays re-serve with the same bound).\n\t\t\tlatencyMax: info.latencyMax,\n\t\t\tpriority: info.priority,\n\t\t\tordered: info.ordered,\n\t\t};\n\t}\n\n\t// Resolve a track's immutable model info via a TRACK stream (lite-05+), for the\n\t// ConsumeBroadcast backing track.Consumer.info(). On older drafts there's no TRACK\n\t// stream, so this rejects rather than fabricating defaults.\n\tasync resolveTrackInfo(broadcast: Path.Valid, track: string): Promise<track.Info> {\n\t\tif (!supportsTrackStream(this.version)) {\n\t\t\tthrow new Error(\"track info requires moq-lite-05 or newer\");\n\t\t}\n\t\treturn this.#toModelInfo(await this.#trackInfo(broadcast, track));\n\t}\n\n\t// Open a FETCH stream for one group and stream its bare frames into a group, for the\n\t// ConsumeBroadcast backing track.Consumer.fetchGroup() (lite-05+).\n\tfetchGroup(\n\t\tbroadcast: Path.Valid,\n\t\ttrack: string,\n\t\tsequence: number,\n\t\toptions: track.FetchGroupOptions = {},\n\t): Promise<netGroup.Consumer> {\n\t\t// Coalesce onto a still-open fetch of the same group so we don't open a second FETCH\n\t\t// stream (and re-download it); each caller reads an independent mirror.\n\t\tconst key = JSON.stringify([broadcast, track, sequence]);\n\t\tconst existing = this.#fetches.get(key);\n\t\tif (existing && !existing.isClosed) return Promise.resolve(existing.mirror());\n\n\t\t// Create and cache the group synchronously (before any await) so a concurrent fetch for\n\t\t// the same group finds it and coalesces rather than racing to open its own stream.\n\t\tconst group = new netGroup.Producer(sequence);\n\t\tthis.#fetches.set(key, group);\n\t\tvoid group.closed.then(() => {\n\t\t\tif (this.#fetches.get(key) === group) this.#fetches.delete(key);\n\t\t});\n\n\t\treturn this.#runFetch(broadcast, track, sequence, options, group);\n\t}\n\n\t// Open the FETCH stream and pump the response into the shared group. Setup errors close the\n\t// group (so coalesced mirrors observe them and the entry evicts) and reject this caller.\n\tasync #runFetch(\n\t\tbroadcast: Path.Valid,\n\t\ttrack: string,\n\t\tsequence: number,\n\t\toptions: track.FetchGroupOptions,\n\t\tgroup: netGroup.Producer,\n\t): Promise<netGroup.Consumer> {\n\t\ttry {\n\t\t\tif (!supportsTrackStream(this.version)) {\n\t\t\t\tthrow new Error(\"fetch group requires moq-lite-05 or newer\");\n\t\t\t}\n\n\t\t\tconst info = await this.#trackInfo(broadcast, track);\n\t\t\tconst priority = options.priority ?? 0;\n\t\t\tconst stream = await Stream.open(this.#quic, undefined, priority);\n\n\t\t\ttry {\n\t\t\t\tawait stream.writer.u53(StreamId.Fetch);\n\t\t\t\tawait new FetchMessage(broadcast, track, priority, sequence).encode(stream.writer, this.version);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tstream.abort(error(err));\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\t// Mint this caller's reader before starting the pump, so the group has demand when the\n\t\t\t// pump begins watching it (an abandoned fetch cancels once every reader has left).\n\t\t\tconst consumer = group.mirror();\n\t\t\tvoid this.#runFetchResponse(stream, group, Time.Timescale(info.timescale));\n\t\t\treturn consumer;\n\t\t} catch (err: unknown) {\n\t\t\tgroup.close(error(err));\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// Read the FETCH response (bare zigzag-delta-timestamped frames) into the group, then\n\t// FIN. A stream-level failure aborts the group so its reader observes the gap.\n\tasync #runFetchResponse(stream: Stream, group: netGroup.Producer, timescale: Time.Timescale): Promise<void> {\n\t\ttry {\n\t\t\tlet prevTs = 0n;\n\n\t\t\t// Serve until the stream FINs, the group closes, or every reader leaves. A group can\n\t\t\t// stay open indefinitely (a catalog or JSON stream), so an abandoned fetch is stopped by\n\t\t\t// demand, not by the stream ending. `closed` and `unused` are watched across frames as\n\t\t\t// stable promises (not re-subscribed to the signals each frame); the unused check is\n\t\t\t// level-triggered, so a coalesced fetch that arrives before we cancel re-arms and resumes.\n\t\t\tconst idle = Symbol(\"idle\");\n\t\t\tconst closed = Promise.resolve<Error | null>(group.closed);\n\t\t\tlet unused = group.unused().then(() => idle);\n\t\t\tfor (;;) {\n\t\t\t\tconst done = await Promise.race([stream.reader.done(), closed, unused]);\n\t\t\t\tif (done === idle) {\n\t\t\t\t\tif (!group.isClosed && group.used.peek()) {\n\t\t\t\t\t\tunused = group.unused().then(() => idle);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (done !== false) break;\n\n\t\t\t\tprevTs += unzigzag(await stream.reader.u62());\n\t\t\t\tconst timestamp = new Time.Timestamp(Number(prevTs), timescale);\n\t\t\t\tconst size = await stream.reader.u53();\n\t\t\t\tconst payload = await stream.reader.read(size);\n\t\t\t\tif (!payload) break;\n\t\t\t\tgroup.writeFrame({ payload, timestamp });\n\t\t\t}\n\n\t\t\tgroup.close();\n\t\t\tstream.close();\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tgroup.close(e);\n\t\t\tstream.abort(e);\n\t\t}\n\t}\n\n\t// Drains SUBSCRIBE_START/END/DROP on the subscribe stream until FIN (lite-05+).\n\t// The resolved range is informational here; the producer already orders groups.\n\t// Resolves (never rejects) on FIN or on the stream being reset out from under it,\n\t// so it's safe to drop from a Promise.race without an unhandled rejection.\n\tasync #drainResponses(stream: Stream): Promise<void> {\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst resp = await decodeSubscribeResponseMaybe(stream.reader, this.version);\n\t\t\t\tif (!resp) return;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Stream closed or reset; nothing more to drain.\n\t\t}\n\t}\n\n\t/**\n\t * Send SUBSCRIBE_UPDATE messages whenever the track's priority signal changes.\n\t *\n\t * Resolves cleanly when the stream or track closes, so the caller can include\n\t * this in Promise.race without leaving a dangling pending write that would\n\t * become an unhandled rejection if the user calls updatePriority after close.\n\t *\n\t * Peeks the signal at the top of every iteration so that updates which landed\n\t * before SubscribeOk arrived (or between iterations, before .next() registered\n\t * its listener) aren't lost.\n\t */\n\tasync #runPriorityUpdates(\n\t\tid: bigint,\n\t\tbroadcast: Path.Valid,\n\t\ttrack: track.Producer,\n\t\tmsg: Subscribe,\n\t\tstream: Stream,\n\t): Promise<void> {\n\t\tconst stopped: Promise<null> = Promise.race([track.closed, stream.reader.closed]).then(() => null);\n\t\tlet lastSent: number | undefined;\n\n\t\tfor (;;) {\n\t\t\tconst current = track.subscription.peek()?.priority;\n\t\t\tif (current === undefined || current === lastSent) {\n\t\t\t\t// Nothing new to send; wait for a change or termination.\n\t\t\t\tconst next = await Promise.race([track.subscription.changed(), stopped]);\n\t\t\t\tif (next === null) return;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Round-trip the other Subscribe parameters so the publisher doesn't\n\t\t\t// interpret SUBSCRIBE_UPDATE as a reset of ordered/maxLatency/etc.\n\t\t\tconst update = new SubscribeUpdate({\n\t\t\t\tpriority: current,\n\t\t\t\tordered: msg.ordered,\n\t\t\t\tmaxLatency: msg.maxLatency,\n\t\t\t\tstartGroup: msg.startGroup,\n\t\t\t\tendGroup: msg.endGroup,\n\t\t\t});\n\t\t\tawait update.encode(stream.writer, this.version);\n\t\t\tlastSent = current;\n\t\t\tconsole.debug(`subscribe update: id=${id} broadcast=${broadcast} track=${track.name} priority=${current}`);\n\t\t}\n\t}\n\n\t/**\n\t * Handles a group message.\n\t * @param group - The group message\n\t * @param stream - The stream to read frames from\n\t *\n\t * @internal\n\t */\n\tasync runGroup(group: GroupMessage, stream: Reader) {\n\t\tconst entry = this.#subscribes.get(group.subscribe);\n\t\tif (!entry) {\n\t\t\tif (group.subscribe >= this.#subscribeNext) {\n\t\t\t\tthrow new Error(`unknown subscription: id=${group.subscribe}`);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst { track, timescale } = entry;\n\t\tconst producer = new netGroup.Producer(group.sequence);\n\t\ttrack.writeGroup(producer);\n\n\t\ttry {\n\t\t\t// Block until the timescale is known; the group's stream can arrive before\n\t\t\t// TRACK_INFO (or implicit defaults) resolves it on the subscribe stream.\n\t\t\tlet scale = timescale.peek();\n\t\t\twhile (scale === undefined) {\n\t\t\t\tif (track.closed.peek() !== undefined) {\n\t\t\t\t\t// Subscription ended before the scale resolved; nothing to decode.\n\t\t\t\t\tproducer.close();\n\t\t\t\t\tstream.stop(new Error(\"cancel\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tawait Signal.race(timescale, track.closed);\n\t\t\t\tscale = timescale.peek();\n\t\t\t}\n\n\t\t\t// A non-zero scale means every frame is prefixed with a zigzag-delta timestamp\n\t\t\t// (the lite-05 FRAME format), which we decode into a Timestamp at that scale.\n\t\t\t// Scale 0 (pre-lite-05) carries no timestamp, so we wall-clock-stamp.\n\t\t\tlet prevTs = 0n;\n\n\t\t\tfor (;;) {\n\t\t\t\tconst done = await Promise.race([stream.done(), track.closed, producer.closed]);\n\t\t\t\tif (done !== false) break;\n\n\t\t\t\tlet timestamp: Time.Timestamp;\n\t\t\t\tif (scale !== 0) {\n\t\t\t\t\tprevTs += unzigzag(await stream.u62());\n\t\t\t\t\ttimestamp = new Time.Timestamp(Number(prevTs), Time.Timescale(scale));\n\t\t\t\t} else {\n\t\t\t\t\ttimestamp = Time.Timestamp.now();\n\t\t\t\t}\n\n\t\t\t\tconst size = await stream.u53();\n\t\t\t\tconst payload = await stream.read(size);\n\t\t\t\tif (!payload) break;\n\n\t\t\t\tproducer.writeFrame({ payload, timestamp });\n\t\t\t}\n\n\t\t\tproducer.close();\n\t\t\tstream.stop(new Error(\"cancel\"));\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tproducer.close(e);\n\t\t\tstream.stop(e);\n\t\t}\n\t}\n\n\t/**\n\t * Receives QUIC datagrams and routes each to its subscription's track producer (lite-05 §6.4).\n\t *\n\t * Returns immediately on a non-datagram transport or pre-lite-05 version. A decode error or an\n\t * unknown subscribe id drops that datagram without tearing down the session (best-effort); the\n\t * loop ends only when the datagram stream closes.\n\t *\n\t * @internal\n\t */\n\tasync runDatagrams(): Promise<void> {\n\t\tif (!hasDatagrams(this.version) || DatagramStream.maxDatagramSize(this.#quic) === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Never reject: this loop is awaited alongside the connection's other tasks, so a\n\t\t// datagram-stream failure must not tear the whole session down (it's best-effort).\n\t\tconst reader = DatagramStream.datagramReader(this.#quic);\n\t\tif (!reader) return;\n\n\t\ttry {\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst { value, done } = await reader.read();\n\t\t\t\t\tif (done) break;\n\t\t\t\t\tif (!value) continue;\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.#routeDatagram(value);\n\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\tconsole.debug(`dropping datagram: ${reason(err)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\treader.releaseLock();\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tconst e = error(err);\n\t\t\tif (e.message === \"The session is closed.\") {\n\t\t\t\tconsole.debug(`datagram receive stopped: ${e.message}`);\n\t\t\t} else {\n\t\t\t\tconsole.warn(\"datagram stream error\", err);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Decode one datagram body and hand it to the matching subscription's producer. Drops the\n\t// datagram (best-effort) if the subscription is unknown/closed or its timescale isn't resolved.\n\tasync #routeDatagram(payload: Uint8Array): Promise<void> {\n\t\tconst dg = await DatagramMessage.decode(payload);\n\n\t\tconst entry = this.#subscribes.get(dg.subscribe);\n\t\tif (!entry) return; // Unknown or already-closed subscription.\n\n\t\t// Datagrams are lite-05+, which always negotiates a timescale; if it hasn't resolved\n\t\t// yet (the datagram raced ahead of TRACK_INFO), drop rather than guess.\n\t\tconst scale = entry.timescale.peek();\n\t\tif (!scale) return;\n\n\t\tconst timestamp = new Time.Timestamp(dg.timestamp, Time.Timescale(scale));\n\t\tentry.track.writeDatagram({ sequence: dg.sequence, timestamp, payload: dg.payload });\n\t}\n\n\t/**\n\t * Opens a PROBE bidi stream to receive bandwidth estimates from the publisher.\n\t * Returns immediately if recv bandwidth is not supported.\n\t *\n\t * Probe is best-effort telemetry: a stream-level failure (peer reset, FIN,\n\t * missing peer support, transport hiccup) is caught and logged, never\n\t * propagated to the connection. On exit the bandwidth/RTT signals are\n\t * cleared so consumers see them as stale.\n\t *\n\t * @internal\n\t */\n\t// Await the peer's advertised probe level, blocking until its SETUP arrives. The peer\n\t// MUST send exactly one SETUP, so this resolves once that stream is read.\n\tasync #peerProbeLevel(peerSetup: Signal<Setup | undefined>): Promise<ProbeLevel> {\n\t\tlet setup = peerSetup.peek();\n\t\twhile (setup === undefined) {\n\t\t\tsetup = await peerSetup.changed();\n\t\t}\n\t\treturn setup.probe;\n\t}\n\n\tasync runProbe(): Promise<void> {\n\t\tif (!this.#probe) return;\n\t\tif (this.version === Version.DRAFT_01 || this.version === Version.DRAFT_02) return;\n\n\t\t// Lite-05+ gates the PROBE stream on the peer advertising Probe >= Report in its\n\t\t// SETUP. Wait for the SETUP, then bail if the peer can't report bitrate. Older\n\t\t// drafts have no SETUP, so they keep probing unconditionally.\n\t\tif (this.#peerSetup) {\n\t\t\tconst probe = await this.#peerProbeLevel(this.#peerSetup);\n\t\t\tif (probe < ProbeLevel.Report) return;\n\t\t}\n\n\t\t// Probe is best-effort: any failure (stream reset by peer, missing peer support,\n\t\t// transport hiccup) MUST NOT tear down the connection. On error, drop the\n\t\t// estimates so consumers know they're stale.\n\t\ttry {\n\t\t\tconst stream = await Stream.open(this.#quic);\n\t\t\tawait stream.writer.u53(StreamId.Probe);\n\n\t\t\tfor (;;) {\n\t\t\t\tconst probe = await Probe.decodeMaybe(stream.reader, this.version);\n\t\t\t\tif (!probe) break;\n\t\t\t\t// A message that omits the RTT leaves the last one standing, so a\n\t\t\t\t// bitrate-only report doesn't blank it.\n\t\t\t\tconst prev = this.#probe.peek();\n\t\t\t\tthis.#probe.set({\n\t\t\t\t\testimatedRecvRate: probe.bitrate ?? undefined,\n\t\t\t\t\trtt: probe.rtt !== undefined ? Time.Milli(probe.rtt) : prev.rtt,\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tif (!this.#closed.signal.aborted) {\n\t\t\t\tconsole.warn(\"probe stream error\", err);\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.#probe.set({});\n\t\t}\n\t}\n\n\tclose() {\n\t\tthis.#closed.abort();\n\n\t\tfor (const { track } of this.#subscribes.values()) {\n\t\t\ttrack.close();\n\t\t}\n\n\t\tthis.#subscribes.clear();\n\t}\n}\n\n/**\n * A broadcast consumed from a lite session. It resolves `track.Consumer.info()` and\n * `.fetchGroup()` over the wire (lite-05+ TRACK / FETCH streams) by reaching into the\n * {@link Subscriber} it was opened from, the way the Rust `BroadcastConsumer` holds its\n * session. Live subscribes still flow through the inherited requested() queue.\n */\nclass ConsumeBroadcast extends broadcast.Consumer {\n\t#subscriber: Subscriber;\n\t#path: Path.Valid;\n\n\tconstructor(subscriber: Subscriber, path: Path.Valid, state?: never) {\n\t\tsuper(state);\n\t\tthis.#subscriber = subscriber;\n\t\tthis.#path = path;\n\t}\n\n\t// Preserve the subclass (and its wire-backed info/fetchGroup) when the consume cache shares\n\t// this broadcast across callers.\n\toverride clone(): ConsumeBroadcast {\n\t\treturn new ConsumeBroadcast(this.#subscriber, this.#path, this.shareState());\n\t}\n\n\toverride resolveTrackInfo(name: string): Promise<track.Info> {\n\t\treturn this.#subscriber.resolveTrackInfo(this.#path, name);\n\t}\n\n\toverride fetchGroup(name: string, sequence: number, options?: track.FetchGroupOptions): Promise<netGroup.Consumer> {\n\t\treturn this.#subscriber.fetchGroup(this.#path, name, sequence, options);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moq/net",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "The networking layer for Media over QUIC: real-time pub/sub with built-in caching, fan-out, and prioritization.",
|
|
6
6
|
"license": "(MIT OR Apache-2.0)",
|
|
7
7
|
"repository": "github:moq-dev/moq",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@moq/qmux": "^0.3.
|
|
20
|
+
"@moq/qmux": "^0.3.2",
|
|
21
21
|
"@moq/signals": "^0.2.0",
|
|
22
22
|
"async-mutex": "^0.5.0"
|
|
23
23
|
},
|
package/stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgBrD,qBAAa,MAAM;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,KAAK,EAAE;QAClB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;QACrC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,WAAW,CAAC;KACtB,EAGA;IAED,OAAa,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAW1F;IAED,OAAa,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG/F;IAED,KAAK,SAGJ;IAED,KAAK,CAAC,MAAM,EAAE,KAAK,QAGlB;CACD;AAID,qBAAa,MAAM;;IAKlB,OAAO,CAAC,EAAE,WAAW,CAAC;IAGtB,YAAY,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE;IAC5F,YAAY,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE;IAmEpE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAK5C;IAEK,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAKnC;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