@moq/net 0.1.4 → 0.1.6
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/announced.d.ts +4 -0
- package/announced.d.ts.map +1 -1
- package/announced.js +5 -0
- package/announced.js.map +1 -1
- package/bandwidth.js +1 -0
- package/broadcast.d.ts +5 -1
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +4 -0
- package/broadcast.js.map +1 -1
- package/connection/accept.d.ts +2 -1
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +1 -0
- package/connection/accept.js.map +1 -1
- package/connection/cert.test.js +1 -0
- package/connection/connect.d.ts +5 -1
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +13 -3
- package/connection/connect.js.map +1 -1
- package/connection/established.d.ts +13 -5
- package/connection/established.d.ts.map +1 -1
- package/connection/established.js +1 -0
- package/connection/established.js.map +1 -1
- package/connection/handshake.d.ts +2 -2
- package/connection/handshake.js +1 -0
- package/connection/index.d.ts +4 -4
- package/connection/index.js +1 -0
- package/connection/reload.d.ts +18 -3
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +13 -4
- package/connection/reload.js.map +1 -1
- package/group.d.ts +37 -7
- package/group.d.ts.map +1 -1
- package/group.js +70 -26
- package/group.js.map +1 -1
- package/group.test.d.ts +2 -0
- package/group.test.d.ts.map +1 -0
- package/group.test.js +66 -0
- package/group.test.js.map +1 -0
- package/ietf/adapter.d.ts +2 -2
- package/ietf/adapter.d.ts.map +1 -1
- package/ietf/adapter.js +1 -0
- package/ietf/adapter.js.map +1 -1
- package/ietf/connection.d.ts +6 -6
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +1 -0
- package/ietf/connection.js.map +1 -1
- package/ietf/control.d.ts +11 -11
- package/ietf/control.d.ts.map +1 -1
- package/ietf/control.js +1 -0
- package/ietf/fetch.d.ts +3 -3
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +1 -0
- package/ietf/fetch.js.map +1 -1
- package/ietf/goaway.d.ts +2 -2
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +1 -0
- package/ietf/goaway.js.map +1 -1
- package/ietf/ietf.test.js +1 -0
- package/ietf/index.d.ts +17 -17
- package/ietf/index.js +1 -0
- package/ietf/message.d.ts +1 -1
- package/ietf/message.js +1 -0
- package/ietf/namespace.d.ts +2 -2
- package/ietf/namespace.js +1 -0
- package/ietf/object.d.ts +2 -2
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +1 -0
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +2 -2
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +1 -0
- package/ietf/properties.d.ts +2 -2
- package/ietf/properties.js +1 -0
- package/ietf/publish.d.ts +3 -3
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +1 -0
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +3 -3
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +1 -0
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.d.ts +7 -7
- package/ietf/publisher.d.ts.map +1 -1
- package/ietf/publisher.js +1 -0
- package/ietf/request.d.ts +3 -3
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +1 -0
- package/ietf/request.js.map +1 -1
- package/ietf/setup.d.ts +3 -3
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +1 -0
- package/ietf/setup.js.map +1 -1
- package/ietf/subscribe.d.ts +3 -3
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +1 -0
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +3 -3
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +1 -0
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.d.ts +8 -8
- package/ietf/subscriber.d.ts.map +1 -1
- package/ietf/subscriber.js +3 -2
- package/ietf/subscriber.js.map +1 -1
- package/ietf/track.d.ts +3 -3
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +1 -0
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +1 -0
- package/index.d.ts +20 -9
- package/index.d.ts.map +1 -1
- package/index.js +7 -0
- package/index.js.map +1 -1
- package/integration.test.js +1 -0
- package/lite/announce.d.ts +4 -4
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +1 -0
- package/lite/announce.js.map +1 -1
- package/lite/connection.d.ts +9 -9
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +2 -1
- package/lite/connection.js.map +1 -1
- package/lite/fetch.d.ts +3 -3
- package/lite/fetch.d.ts.map +1 -1
- package/lite/fetch.js +1 -0
- package/lite/goaway.d.ts +2 -2
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +1 -0
- package/lite/group.d.ts +1 -1
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +1 -0
- package/lite/index.d.ts +10 -10
- package/lite/index.js +1 -0
- package/lite/message.d.ts +1 -1
- package/lite/message.js +1 -0
- package/lite/origin.d.ts +7 -1
- package/lite/origin.d.ts.map +1 -1
- package/lite/origin.js +10 -3
- package/lite/origin.js.map +1 -1
- package/lite/probe.d.ts +2 -2
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +1 -0
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +7 -7
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +1 -0
- package/lite/publisher.js.map +1 -1
- package/lite/session.d.ts +2 -2
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +1 -0
- package/lite/stream.d.ts +5 -5
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +1 -0
- package/lite/subscribe.d.ts +3 -3
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1 -0
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +9 -9
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +3 -2
- package/lite/subscriber.js.map +1 -1
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +1 -0
- package/mock.js +1 -0
- package/package.json +2 -2
- package/path.d.ts +2 -0
- package/path.d.ts.map +1 -1
- package/path.js +3 -0
- package/path.js.map +1 -1
- package/path.test.js +1 -0
- package/stream.d.ts +1 -1
- package/stream.d.ts.map +1 -1
- package/stream.js +1 -0
- package/stream.test.js +1 -0
- package/time.d.ts +8 -0
- package/time.d.ts.map +1 -1
- package/time.js +5 -0
- package/time.js.map +1 -1
- package/track.d.ts +14 -1
- package/track.d.ts.map +1 -1
- package/track.js +27 -11
- package/track.js.map +1 -1
- package/track.test.js +17 -0
- package/track.test.js.map +1 -1
- package/util/error.js +1 -0
- package/util/hex.js +1 -0
- package/util/index.d.ts +1 -1
- package/util/index.js +1 -0
- package/varint.d.ts +8 -0
- package/varint.d.ts.map +1 -1
- package/varint.js +9 -0
- package/varint.js.map +1 -1
- package/varint.test.js +1 -0
- package/zod.d.ts +9 -2
- package/zod.d.ts.map +1 -1
- package/zod.js +8 -1
- package/zod.js.map +1 -1
package/connection/reload.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
/* @ts-self-types="./reload.d.ts" */
|
|
1
2
|
import { Effect, Signal } from "@moq/signals";
|
|
2
3
|
import { empty as emptyPath } from "../path.js";
|
|
3
4
|
import { connect } from "./connect.js";
|
|
5
|
+
/** Maintains a MoQ connection, reconnecting with exponential backoff when it drops. */
|
|
4
6
|
export class Reload {
|
|
7
|
+
/** Relay URL to connect to; updating it triggers a reconnect. */
|
|
5
8
|
url;
|
|
9
|
+
/** Whether reconnecting is active. */
|
|
6
10
|
enabled;
|
|
11
|
+
/** Current connection status. */
|
|
7
12
|
status = new Signal("disconnected");
|
|
13
|
+
/** The currently established session, or undefined while disconnected. */
|
|
8
14
|
established = new Signal(undefined);
|
|
9
15
|
// All actively announced broadcast paths, updated reactively.
|
|
10
16
|
#announced = new Signal(new Set());
|
|
17
|
+
/** The set of broadcast paths currently announced by the server, updated reactively. */
|
|
11
18
|
announced = this.#announced;
|
|
12
|
-
|
|
19
|
+
/** WebTransport options applied to each connection attempt (not reactive). */
|
|
13
20
|
webtransport;
|
|
14
|
-
|
|
21
|
+
/** WebSocket fallback options applied to each connection attempt (not reactive). */
|
|
15
22
|
websocket;
|
|
16
|
-
|
|
23
|
+
/** Backoff settings for the reconnect loop. */
|
|
17
24
|
delay;
|
|
25
|
+
/** The reactive effect scope driving the connect loop; closed by {@link Reload.close}. */
|
|
18
26
|
signals = new Effect();
|
|
19
|
-
|
|
27
|
+
/** Resolves when the reconnect loop stops via {@link Reload.close} or the retry timeout. */
|
|
20
28
|
closed;
|
|
21
29
|
#closedResolve;
|
|
22
30
|
#closedReject;
|
|
@@ -120,6 +128,7 @@ export class Reload {
|
|
|
120
128
|
}
|
|
121
129
|
});
|
|
122
130
|
}
|
|
131
|
+
/** Stop reconnecting, close the current connection, and resolve {@link Reload.closed}. */
|
|
123
132
|
close() {
|
|
124
133
|
this.signals.close();
|
|
125
134
|
this.#closedResolve();
|
package/connection/reload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAqB,OAAO,EAAiD,MAAM,cAAc,CAAC;AAoCzG,MAAM,OAAO,MAAM;IAClB,GAAG,CAA0B;IAC7B,OAAO,CAAkB;IAEzB,MAAM,GAAG,IAAI,MAAM,CAAe,cAAc,CAAC,CAAC;IAClD,WAAW,GAAG,IAAI,MAAM,CAA0B,SAAS,CAAC,CAAC;IAE7D,8DAA8D;IAC9D,UAAU,GAAG,IA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,MAAM,EAAE,CAAC;4BAClB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;wBACxB,CAAC;6BAAM,CAAC;4BACP,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;wBAC3B,CAAC;oBACF,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;gBAC/B,MAAM,GAAG,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { Effect, type Getter, Signal } from \"@moq/signals\";\nimport type * as Path from \"../path.ts\";\nimport { empty as emptyPath } from \"../path.ts\";\nimport { type ConnectProps, connect, type WebSocketOptions, type WebTransportProps } from \"./connect.ts\";\nimport type { Established } from \"./established.ts\";\n\nexport type ReloadDelay = {\n\t// The delay in milliseconds before reconnecting.\n\t// default: 1000\n\tinitial: DOMHighResTimeStamp;\n\n\t// The multiplier for the delay.\n\t// default: 2\n\tmultiplier: number;\n\n\t// The maximum delay in milliseconds.\n\t// default: 30000\n\tmax: DOMHighResTimeStamp;\n\n\t// Maximum total time in milliseconds to spend retrying before giving up.\n\t// Resets after each successful connection. Set to 0 for unlimited retries.\n\t// default: 300000 (5 minutes)\n\ttimeout?: DOMHighResTimeStamp;\n};\n\nexport type ReloadProps = ConnectProps & {\n\t// Whether to reload the connection when it disconnects.\n\t// default: true\n\tenabled?: boolean | Signal<boolean>;\n\n\t// The URL of the relay server.\n\turl?: URL | Signal<URL | undefined>;\n\n\t// The delay for the reload.\n\tdelay?: ReloadDelay;\n};\n\nexport type ReloadStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\nexport class Reload {\n\turl: Signal<URL | undefined>;\n\tenabled: Signal<boolean>;\n\n\tstatus = new Signal<ReloadStatus>(\"disconnected\");\n\testablished = new Signal<Established | undefined>(undefined);\n\n\t// All actively announced broadcast paths, updated reactively.\n\t#announced = new Signal<Set<Path.Valid>>(new Set());\n\treadonly announced: Getter<Set<Path.Valid>> = this.#announced;\n\n\t// WebTransport options (not reactive).\n\twebtransport?: WebTransportProps;\n\n\t// WebSocket (fallback) options (not reactive).\n\twebsocket: WebSocketOptions | undefined;\n\n\t// Not reactive, but can be updated.\n\tdelay: ReloadDelay;\n\n\tsignals = new Effect();\n\n\t// Resolves when the reconnect loop stops (close() or timeout).\n\tclosed: Promise<void>;\n\t#closedResolve!: () => void;\n\t#closedReject!: (err: Error) => void;\n\n\t#delay: DOMHighResTimeStamp;\n\n\t// Timestamp when the current retry sequence started (for timeout).\n\t#retryStart: DOMHighResTimeStamp | undefined;\n\n\t// Increased by 1 each time to trigger a reload.\n\t#tick = new Signal(0);\n\n\tconstructor(props?: ReloadProps) {\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? false);\n\t\tthis.delay = props?.delay ?? { initial: 1000, multiplier: 2, max: 30000 };\n\t\tthis.webtransport = props?.webtransport;\n\t\tthis.websocket = props?.websocket;\n\n\t\tthis.#delay = this.delay.initial;\n\n\t\tthis.closed = new Promise((resolve, reject) => {\n\t\t\tthis.#closedResolve = resolve;\n\t\t\tthis.#closedReject = reject;\n\t\t});\n\n\t\t// Create a reactive root so cleanup is easier.\n\t\tthis.signals.run(this.#connect.bind(this));\n\t\tthis.signals.run(this.#runAnnounced.bind(this));\n\t}\n\n\t#connect(effect: Effect): void {\n\t\t// Will retry when the tick changes.\n\t\teffect.get(this.#tick);\n\n\t\tconst enabled = effect.get(this.enabled);\n\t\tif (!enabled) return;\n\n\t\tconst url = effect.get(this.url);\n\t\tif (!url) return;\n\n\t\teffect.set(this.status, \"connecting\", \"disconnected\");\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tconst pending = connect(url, { websocket: this.websocket, webtransport: this.webtransport });\n\n\t\t\t\tconst connection = await Promise.race([effect.cancel, pending]);\n\t\t\t\tif (!connection) {\n\t\t\t\t\tpending.then((conn) => conn.close()).catch(() => {});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\teffect.set(this.established, connection);\n\t\t\t\teffect.cleanup(() => connection.close());\n\n\t\t\t\teffect.set(this.status, \"connected\", \"disconnected\");\n\n\t\t\t\t// Reset the exponential backoff and timeout on success.\n\t\t\t\tthis.#delay = this.delay.initial;\n\t\t\t\tthis.#retryStart = undefined;\n\n\t\t\t\tawait Promise.race([effect.cancel, connection.closed]);\n\t\t\t} catch (err) {\n\t\t\t\tconsole.warn(\"connection error:\", err);\n\n\t\t\t\t// Track retry start for timeout.\n\t\t\t\tthis.#retryStart ??= performance.now();\n\n\t\t\t\tconst timeout = this.delay.timeout ?? 300000;\n\t\t\t\tif (timeout > 0) {\n\t\t\t\t\tconst elapsed = performance.now() - this.#retryStart;\n\t\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\t\tconsole.warn(\"reconnect timed out\");\n\t\t\t\t\t\tthis.#closedReject(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst tick = this.#tick.peek() + 1;\n\t\t\t\teffect.timer(() => this.#tick.update((prev) => Math.max(prev, tick)), this.#delay);\n\n\t\t\t\tthis.#delay = Math.min(this.#delay * this.delay.multiplier, this.delay.max);\n\t\t\t}\n\t\t});\n\t}\n\n\t#runAnnounced(effect: Effect): void {\n\t\tthis.#announced.set(new Set());\n\n\t\tconst conn = effect.get(this.established);\n\t\tif (!conn) return;\n\n\t\teffect.cleanup(() => this.#announced.set(new Set()));\n\n\t\t// Cloudflare's relay does not yet support SUBSCRIBE_NAMESPACE, so\n\t\t// skip announce subscriptions entirely for those hosts.\n\t\tif (conn.url.hostname.endsWith(\"mediaoverquic.com\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst announced = conn.announced(emptyPath());\n\t\teffect.cleanup(() => announced.close());\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst entry = await Promise.race([effect.cancel, announced.next()]);\n\t\t\t\t\tif (!entry) break;\n\n\t\t\t\t\tthis.#announced.mutate((active) => {\n\t\t\t\t\t\tif (entry.active) {\n\t\t\t\t\t\t\tactive.add(entry.path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactive.delete(entry.path);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tthis.#announced.set(new Set());\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\tclose() {\n\t\tthis.signals.close();\n\t\tthis.#closedResolve();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAqB,OAAO,EAAiD,MAAM,cAAc,CAAC;AAuCzG,uFAAuF;AACvF,MAAM,OAAO,MAAM;IAClB,iEAAiE;IACjE,GAAG,CAA0B;IAE7B,sCAAsC;IACtC,OAAO,CAAkB;IAEzB,iCAAiC;IACjC,MAAM,GAAG,IAAI,MAAM,CAAe,cAAc,CAAC,CAAC;IAElD,0EAA0E;IAC1E,WAAW,GAAG,IAAI,MAAM,CAA0B,SAAS,CAAC,CAAC;IAE7D,8DAA8D;IAC9D,UAAU,GAAG,IAAI,MAAM,CAAkB,IAAI,GAAG,EAAE,CAAC,CAAC;IAEpD,wFAAwF;IAC/E,SAAS,GAA4B,IAAI,CAAC,UAAU,CAAC;IAE9D,8EAA8E;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AC;6BAAM,CAAC;4BACP,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;wBAC3B,CAAC;oBACF,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;gBAC/B,MAAM,GAAG,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,0FAA0F;IAC1F,KAAK;QACJ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { Effect, type Getter, Signal } from \"@moq/signals\";\nimport type * as Path from \"../path.ts\";\nimport { empty as emptyPath } from \"../path.ts\";\nimport { type ConnectProps, connect, type WebSocketOptions, type WebTransportProps } from \"./connect.ts\";\nimport type { Established } from \"./established.ts\";\n\n/** Exponential backoff settings for {@link Reload}'s reconnect loop. */\nexport type ReloadDelay = {\n\t// The delay in milliseconds before reconnecting.\n\t// default: 1000\n\tinitial: DOMHighResTimeStamp;\n\n\t// The multiplier for the delay.\n\t// default: 2\n\tmultiplier: number;\n\n\t// The maximum delay in milliseconds.\n\t// default: 30000\n\tmax: DOMHighResTimeStamp;\n\n\t// Maximum total time in milliseconds to spend retrying before giving up.\n\t// Resets after each successful connection. Set to 0 for unlimited retries.\n\t// default: 300000 (5 minutes)\n\ttimeout?: DOMHighResTimeStamp;\n};\n\n/** Options for {@link Reload}: connect options plus reactive URL/enabled signals and backoff tuning. */\nexport type ReloadProps = ConnectProps & {\n\t// Whether to reload the connection when it disconnects.\n\t// default: true\n\tenabled?: boolean | Signal<boolean>;\n\n\t// The URL of the relay server.\n\turl?: URL | Signal<URL | undefined>;\n\n\t// The delay for the reload.\n\tdelay?: ReloadDelay;\n};\n\n/** Current state of a {@link Reload} connection. */\nexport type ReloadStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\n/** Maintains a MoQ connection, reconnecting with exponential backoff when it drops. */\nexport class Reload {\n\t/** Relay URL to connect to; updating it triggers a reconnect. */\n\turl: Signal<URL | undefined>;\n\n\t/** Whether reconnecting is active. */\n\tenabled: Signal<boolean>;\n\n\t/** Current connection status. */\n\tstatus = new Signal<ReloadStatus>(\"disconnected\");\n\n\t/** The currently established session, or undefined while disconnected. */\n\testablished = new Signal<Established | undefined>(undefined);\n\n\t// All actively announced broadcast paths, updated reactively.\n\t#announced = new Signal<Set<Path.Valid>>(new Set());\n\n\t/** The set of broadcast paths currently announced by the server, updated reactively. */\n\treadonly announced: Getter<Set<Path.Valid>> = this.#announced;\n\n\t/** WebTransport options applied to each connection attempt (not reactive). */\n\twebtransport?: WebTransportProps;\n\n\t/** WebSocket fallback options applied to each connection attempt (not reactive). */\n\twebsocket: WebSocketOptions | undefined;\n\n\t/** Backoff settings for the reconnect loop. */\n\tdelay: ReloadDelay;\n\n\t/** The reactive effect scope driving the connect loop; closed by {@link Reload.close}. */\n\tsignals = new Effect();\n\n\t/** Resolves when the reconnect loop stops via {@link Reload.close} or the retry timeout. */\n\tclosed: Promise<void>;\n\t#closedResolve!: () => void;\n\t#closedReject!: (err: Error) => void;\n\n\t#delay: DOMHighResTimeStamp;\n\n\t// Timestamp when the current retry sequence started (for timeout).\n\t#retryStart: DOMHighResTimeStamp | undefined;\n\n\t// Increased by 1 each time to trigger a reload.\n\t#tick = new Signal(0);\n\n\tconstructor(props?: ReloadProps) {\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? false);\n\t\tthis.delay = props?.delay ?? { initial: 1000, multiplier: 2, max: 30000 };\n\t\tthis.webtransport = props?.webtransport;\n\t\tthis.websocket = props?.websocket;\n\n\t\tthis.#delay = this.delay.initial;\n\n\t\tthis.closed = new Promise((resolve, reject) => {\n\t\t\tthis.#closedResolve = resolve;\n\t\t\tthis.#closedReject = reject;\n\t\t});\n\n\t\t// Create a reactive root so cleanup is easier.\n\t\tthis.signals.run(this.#connect.bind(this));\n\t\tthis.signals.run(this.#runAnnounced.bind(this));\n\t}\n\n\t#connect(effect: Effect): void {\n\t\t// Will retry when the tick changes.\n\t\teffect.get(this.#tick);\n\n\t\tconst enabled = effect.get(this.enabled);\n\t\tif (!enabled) return;\n\n\t\tconst url = effect.get(this.url);\n\t\tif (!url) return;\n\n\t\teffect.set(this.status, \"connecting\", \"disconnected\");\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tconst pending = connect(url, { websocket: this.websocket, webtransport: this.webtransport });\n\n\t\t\t\tconst connection = await Promise.race([effect.cancel, pending]);\n\t\t\t\tif (!connection) {\n\t\t\t\t\tpending.then((conn) => conn.close()).catch(() => {});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\teffect.set(this.established, connection);\n\t\t\t\teffect.cleanup(() => connection.close());\n\n\t\t\t\teffect.set(this.status, \"connected\", \"disconnected\");\n\n\t\t\t\t// Reset the exponential backoff and timeout on success.\n\t\t\t\tthis.#delay = this.delay.initial;\n\t\t\t\tthis.#retryStart = undefined;\n\n\t\t\t\tawait Promise.race([effect.cancel, connection.closed]);\n\t\t\t} catch (err) {\n\t\t\t\tconsole.warn(\"connection error:\", err);\n\n\t\t\t\t// Track retry start for timeout.\n\t\t\t\tthis.#retryStart ??= performance.now();\n\n\t\t\t\tconst timeout = this.delay.timeout ?? 300000;\n\t\t\t\tif (timeout > 0) {\n\t\t\t\t\tconst elapsed = performance.now() - this.#retryStart;\n\t\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\t\tconsole.warn(\"reconnect timed out\");\n\t\t\t\t\t\tthis.#closedReject(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst tick = this.#tick.peek() + 1;\n\t\t\t\teffect.timer(() => this.#tick.update((prev) => Math.max(prev, tick)), this.#delay);\n\n\t\t\t\tthis.#delay = Math.min(this.#delay * this.delay.multiplier, this.delay.max);\n\t\t\t}\n\t\t});\n\t}\n\n\t#runAnnounced(effect: Effect): void {\n\t\tthis.#announced.set(new Set());\n\n\t\tconst conn = effect.get(this.established);\n\t\tif (!conn) return;\n\n\t\teffect.cleanup(() => this.#announced.set(new Set()));\n\n\t\t// Cloudflare's relay does not yet support SUBSCRIBE_NAMESPACE, so\n\t\t// skip announce subscriptions entirely for those hosts.\n\t\tif (conn.url.hostname.endsWith(\"mediaoverquic.com\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst announced = conn.announced(emptyPath());\n\t\teffect.cleanup(() => announced.close());\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst entry = await Promise.race([effect.cancel, announced.next()]);\n\t\t\t\t\tif (!entry) break;\n\n\t\t\t\t\tthis.#announced.mutate((active) => {\n\t\t\t\t\t\tif (entry.active) {\n\t\t\t\t\t\t\tactive.add(entry.path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactive.delete(entry.path);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tthis.#announced.set(new Set());\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Stop reconnecting, close the current connection, and resolve {@link Reload.closed}. */\n\tclose() {\n\t\tthis.signals.close();\n\t\tthis.#closedResolve();\n\t}\n}\n"]}
|
package/group.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export declare class GroupState {
|
|
3
|
-
frames: Signal<Uint8Array<ArrayBufferLike>[]>;
|
|
4
|
-
closed: Signal<boolean | Error>;
|
|
5
|
-
total: Signal<number>;
|
|
6
|
-
}
|
|
1
|
+
/** An ordered stream of frames within a track, delivered over a single QUIC stream. */
|
|
7
2
|
export declare class Group {
|
|
3
|
+
#private;
|
|
4
|
+
/** Sequence number of this group within its track. */
|
|
8
5
|
readonly sequence: number;
|
|
9
|
-
|
|
6
|
+
/** Resolves with the abort error (or undefined) once closed. */
|
|
10
7
|
readonly closed: Promise<Error | undefined>;
|
|
11
8
|
constructor(sequence: number);
|
|
12
9
|
/**
|
|
@@ -14,21 +11,54 @@ export declare class Group {
|
|
|
14
11
|
* @param frame - The frame to write
|
|
15
12
|
*/
|
|
16
13
|
writeFrame(frame: Uint8Array): void;
|
|
14
|
+
/** Write a string as a single UTF-8 encoded frame. */
|
|
17
15
|
writeString(str: string): void;
|
|
16
|
+
/** Write a value as a single JSON-encoded frame. */
|
|
18
17
|
writeJson(json: unknown): void;
|
|
18
|
+
/** Write a boolean as a single one-byte frame. */
|
|
19
19
|
writeBool(bool: boolean): void;
|
|
20
|
+
/** True once no further frames can be read: the group has closed and every buffered frame is read. */
|
|
21
|
+
get done(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Reads the next already-buffered frame without blocking.
|
|
24
|
+
*
|
|
25
|
+
* Returns `undefined` when nothing is buffered right now. That is *not* by itself end-of-group:
|
|
26
|
+
* check {@link done} to tell "no frame buffered yet" (more may arrive) from "the group finished".
|
|
27
|
+
* Drain a backlog by looping until this returns `undefined`, then branch on {@link done}: if not
|
|
28
|
+
* done, {@link readable} resolves when the next frame arrives.
|
|
29
|
+
*/
|
|
30
|
+
tryReadFrame(): Uint8Array | undefined;
|
|
31
|
+
/** Like {@link tryReadFrame} but also reports the frame's sequence number within the group. */
|
|
32
|
+
tryReadFrameSequence(): {
|
|
33
|
+
sequence: number;
|
|
34
|
+
data: Uint8Array;
|
|
35
|
+
} | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Resolves once {@link readFrame} would not block: a frame is buffered, or the group has closed.
|
|
38
|
+
* Always settles (never hangs), so on a finished group it resolves immediately; pair it with
|
|
39
|
+
* {@link done} to avoid re-waiting on a group that has nothing left.
|
|
40
|
+
*
|
|
41
|
+
* Lets a caller fold "this group has a frame" into a larger wait (e.g. racing it against a new
|
|
42
|
+
* group arriving) without touching the group's internal signals.
|
|
43
|
+
*/
|
|
44
|
+
readable(): Promise<void>;
|
|
20
45
|
/**
|
|
21
46
|
* Reads the next frame from the group.
|
|
22
47
|
* @returns A promise that resolves to the next frame or undefined
|
|
23
48
|
*/
|
|
24
49
|
readFrame(): Promise<Uint8Array | undefined>;
|
|
50
|
+
/** Reads the next frame along with its sequence number within the group. */
|
|
25
51
|
readFrameSequence(): Promise<{
|
|
26
52
|
sequence: number;
|
|
27
53
|
data: Uint8Array;
|
|
28
54
|
} | undefined>;
|
|
55
|
+
/** Reads the next frame and decodes it as a UTF-8 string. */
|
|
29
56
|
readString(): Promise<string | undefined>;
|
|
57
|
+
/** Reads the next frame and parses it as JSON. */
|
|
30
58
|
readJson(): Promise<unknown | undefined>;
|
|
59
|
+
/** Reads the next frame and decodes it as a one-byte boolean. */
|
|
31
60
|
readBool(): Promise<boolean | undefined>;
|
|
61
|
+
/** Closes the group, optionally with an error to abort readers. */
|
|
32
62
|
close(abort?: Error): void;
|
|
33
63
|
}
|
|
34
64
|
//# sourceMappingURL=group.d.ts.map
|
package/group.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AASA,uFAAuF;AACvF,qBAAa,KAAK;;IACjB,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAM1B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAE5C,YAAY,QAAQ,EAAE,MAAM,EAW3B;IAED;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,UAAU,QAQ3B;IAED,sDAAsD;IACtD,WAAW,CAAC,GAAG,EAAE,MAAM,QAEtB;IAED,oDAAoD;IACpD,SAAS,CAAC,IAAI,EAAE,OAAO,QAEtB;IAED,kDAAkD;IAClD,SAAS,CAAC,IAAI,EAAE,OAAO,QAEtB;IAED,sGAAsG;IACtG,IAAI,IAAI,IAAI,OAAO,CAElB;IAED;;;;;;;OAOG;IACH,YAAY,IAAI,UAAU,GAAG,SAAS,CAErC;IAED,+FAA+F;IAC/F,oBAAoB,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,GAAG,SAAS,CAKzE;IAED;;;;;;;OAOG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAM9B;IAED;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEjD;IAED,4EAA4E;IACtE,iBAAiB,IAAI,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,GAAG,SAAS,CAAC,CAYrF;IAED,6DAA6D;IACvD,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG9C;IAED,kDAAkD;IAC5C,QAAQ,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAG7C;IAED,iEAAiE;IAC3D,QAAQ,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAG7C;IAED,mEAAmE;IACnE,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,QAElB;CACD"}
|
package/group.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
+
/* @ts-self-types="./group.d.ts" */
|
|
1
2
|
import { Signal } from "@moq/signals";
|
|
2
|
-
|
|
3
|
+
/** Reactive backing state for a {@link Group}: buffered frames, a closed flag, and the running frame count. */
|
|
4
|
+
class GroupState {
|
|
3
5
|
frames = new Signal([]);
|
|
4
6
|
closed = new Signal(false);
|
|
5
7
|
total = new Signal(0); // The total number of frames in the group thus far
|
|
6
8
|
}
|
|
9
|
+
/** An ordered stream of frames within a track, delivered over a single QUIC stream. */
|
|
7
10
|
export class Group {
|
|
11
|
+
/** Sequence number of this group within its track. */
|
|
8
12
|
sequence;
|
|
9
|
-
state
|
|
13
|
+
// Reactive backing state, deliberately private: read through the read* methods so callers can't
|
|
14
|
+
// poke the signals directly (and so the internal representation can change).
|
|
15
|
+
#state = new GroupState();
|
|
16
|
+
/** Resolves with the abort error (or undefined) once closed. */
|
|
10
17
|
closed;
|
|
11
18
|
constructor(sequence) {
|
|
12
19
|
this.sequence = sequence;
|
|
13
20
|
// Cache the closed promise to avoid recreating it every time.
|
|
14
21
|
this.closed = new Promise((resolve) => {
|
|
15
|
-
const dispose = this
|
|
22
|
+
const dispose = this.#state.closed.subscribe((closed) => {
|
|
16
23
|
if (!closed)
|
|
17
24
|
return;
|
|
18
25
|
resolve(closed instanceof Error ? closed : undefined);
|
|
@@ -25,68 +32,105 @@ export class Group {
|
|
|
25
32
|
* @param frame - The frame to write
|
|
26
33
|
*/
|
|
27
34
|
writeFrame(frame) {
|
|
28
|
-
if (this
|
|
35
|
+
if (this.#state.closed.peek())
|
|
29
36
|
throw new Error("group is closed");
|
|
30
|
-
this
|
|
37
|
+
this.#state.frames.mutate((frames) => {
|
|
31
38
|
frames.push(frame);
|
|
32
39
|
});
|
|
33
|
-
this
|
|
40
|
+
this.#state.total.update((total) => total + 1);
|
|
34
41
|
}
|
|
42
|
+
/** Write a string as a single UTF-8 encoded frame. */
|
|
35
43
|
writeString(str) {
|
|
36
44
|
this.writeFrame(new TextEncoder().encode(str));
|
|
37
45
|
}
|
|
46
|
+
/** Write a value as a single JSON-encoded frame. */
|
|
38
47
|
writeJson(json) {
|
|
39
48
|
this.writeString(JSON.stringify(json));
|
|
40
49
|
}
|
|
50
|
+
/** Write a boolean as a single one-byte frame. */
|
|
41
51
|
writeBool(bool) {
|
|
42
52
|
this.writeFrame(new Uint8Array([bool ? 1 : 0]));
|
|
43
53
|
}
|
|
54
|
+
/** True once no further frames can be read: the group has closed and every buffered frame is read. */
|
|
55
|
+
get done() {
|
|
56
|
+
return this.#state.frames.peek().length === 0 && this.#state.closed.peek() !== false;
|
|
57
|
+
}
|
|
44
58
|
/**
|
|
45
|
-
* Reads the next frame
|
|
46
|
-
*
|
|
59
|
+
* Reads the next already-buffered frame without blocking.
|
|
60
|
+
*
|
|
61
|
+
* Returns `undefined` when nothing is buffered right now. That is *not* by itself end-of-group:
|
|
62
|
+
* check {@link done} to tell "no frame buffered yet" (more may arrive) from "the group finished".
|
|
63
|
+
* Drain a backlog by looping until this returns `undefined`, then branch on {@link done}: if not
|
|
64
|
+
* done, {@link readable} resolves when the next frame arrives.
|
|
47
65
|
*/
|
|
48
|
-
|
|
66
|
+
tryReadFrame() {
|
|
67
|
+
return this.tryReadFrameSequence()?.data;
|
|
68
|
+
}
|
|
69
|
+
/** Like {@link tryReadFrame} but also reports the frame's sequence number within the group. */
|
|
70
|
+
tryReadFrameSequence() {
|
|
71
|
+
const frames = this.#state.frames.peek();
|
|
72
|
+
const data = frames.shift();
|
|
73
|
+
if (data === undefined)
|
|
74
|
+
return undefined;
|
|
75
|
+
return { sequence: this.#state.total.peek() - frames.length - 1, data };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resolves once {@link readFrame} would not block: a frame is buffered, or the group has closed.
|
|
79
|
+
* Always settles (never hangs), so on a finished group it resolves immediately; pair it with
|
|
80
|
+
* {@link done} to avoid re-waiting on a group that has nothing left.
|
|
81
|
+
*
|
|
82
|
+
* Lets a caller fold "this group has a frame" into a larger wait (e.g. racing it against a new
|
|
83
|
+
* group arriving) without touching the group's internal signals.
|
|
84
|
+
*/
|
|
85
|
+
async readable() {
|
|
49
86
|
for (;;) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
return frame;
|
|
54
|
-
const closed = this.state.closed.peek();
|
|
55
|
-
if (closed instanceof Error)
|
|
56
|
-
throw closed;
|
|
57
|
-
if (closed)
|
|
87
|
+
if (this.#state.frames.peek().length > 0)
|
|
88
|
+
return;
|
|
89
|
+
if (this.#state.closed.peek())
|
|
58
90
|
return;
|
|
59
|
-
await Signal.race(this
|
|
91
|
+
await Signal.race(this.#state.frames, this.#state.closed);
|
|
60
92
|
}
|
|
61
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Reads the next frame from the group.
|
|
96
|
+
* @returns A promise that resolves to the next frame or undefined
|
|
97
|
+
*/
|
|
98
|
+
async readFrame() {
|
|
99
|
+
return (await this.readFrameSequence())?.data;
|
|
100
|
+
}
|
|
101
|
+
/** Reads the next frame along with its sequence number within the group. */
|
|
62
102
|
async readFrameSequence() {
|
|
63
103
|
for (;;) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const closed = this
|
|
104
|
+
const next = this.tryReadFrameSequence();
|
|
105
|
+
if (next)
|
|
106
|
+
return next;
|
|
107
|
+
// Drain buffered frames before observing the close, so a closed group still yields them.
|
|
108
|
+
const closed = this.#state.closed.peek();
|
|
69
109
|
if (closed instanceof Error)
|
|
70
110
|
throw closed;
|
|
71
111
|
if (closed)
|
|
72
|
-
return;
|
|
73
|
-
await
|
|
112
|
+
return undefined;
|
|
113
|
+
await this.readable();
|
|
74
114
|
}
|
|
75
115
|
}
|
|
116
|
+
/** Reads the next frame and decodes it as a UTF-8 string. */
|
|
76
117
|
async readString() {
|
|
77
118
|
const frame = await this.readFrame();
|
|
78
119
|
return frame ? new TextDecoder().decode(frame) : undefined;
|
|
79
120
|
}
|
|
121
|
+
/** Reads the next frame and parses it as JSON. */
|
|
80
122
|
async readJson() {
|
|
81
123
|
const frame = await this.readString();
|
|
82
124
|
return frame ? JSON.parse(frame) : undefined;
|
|
83
125
|
}
|
|
126
|
+
/** Reads the next frame and decodes it as a one-byte boolean. */
|
|
84
127
|
async readBool() {
|
|
85
128
|
const frame = await this.readFrame();
|
|
86
129
|
return frame ? frame[0] === 1 : undefined;
|
|
87
130
|
}
|
|
131
|
+
/** Closes the group, optionally with an error to abort readers. */
|
|
88
132
|
close(abort) {
|
|
89
|
-
this
|
|
133
|
+
this.#state.closed.set(abort ?? true);
|
|
90
134
|
}
|
|
91
135
|
}
|
|
92
136
|
//# sourceMappingURL=group.js.map
|
package/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,+GAA+G;AAC/G,MAAM,UAAU;IACf,MAAM,GAAG,IAAI,MAAM,CAAe,EAAE,CAAC,CAAC;IACtC,MAAM,GAAG,IAAI,MAAM,CAAkB,KAAK,CAAC,CAAC;IAC5C,KAAK,GAAG,IAAI,MAAM,CAAS,CAAC,CAAC,CAAC,CAAC,mDAAmD;CAClF;AAED,uFAAuF;AACvF,MAAM,OAAO,KAAK;IACjB,sDAAsD;IAC7C,QAAQ,CAAS;IAE1B,gGAAgG;IAChG,6EAA6E;IAC7E,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAE1B,gEAAgE;IACvD,MAAM,CAA6B;IAE5C,YAAY,QAAgB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,8DAA8D;QAC9D,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;gBACvD,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,OAAO,CAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;gBACtD,OAAO,EAAE,CAAC;YAC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AQ,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,UAAU;QACf,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5D,CAAC;IAED,kDAAkD;IAClD,KAAK,CAAC,QAAQ;QACb,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9C,CAAC;IAED,iEAAiE;IACjE,KAAK,CAAC,QAAQ;QACb,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3C,CAAC;IAED,mEAAmE;IACnE,KAAK,CAAC,KAAa;QAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;IACvC,CAAC;CACD","sourcesContent":["import { Signal } from \"@moq/signals\";\n\n/** Reactive backing state for a {@link Group}: buffered frames, a closed flag, and the running frame count. */\nclass GroupState {\n\tframes = new Signal<Uint8Array[]>([]);\n\tclosed = new Signal<boolean | Error>(false);\n\ttotal = new Signal<number>(0); // The total number of frames in the group thus far\n}\n\n/** An ordered stream of frames within a track, delivered over a single QUIC stream. */\nexport class Group {\n\t/** Sequence number of this group within its track. */\n\treadonly sequence: number;\n\n\t// Reactive backing state, deliberately private: read through the read* methods so callers can't\n\t// poke the signals directly (and so the internal representation can change).\n\t#state = new GroupState();\n\n\t/** Resolves with the abort error (or undefined) once closed. */\n\treadonly closed: Promise<Error | undefined>;\n\n\tconstructor(sequence: number) {\n\t\tthis.sequence = sequence;\n\n\t\t// Cache the closed promise to avoid recreating it every time.\n\t\tthis.closed = new Promise((resolve) => {\n\t\t\tconst dispose = this.#state.closed.subscribe((closed) => {\n\t\t\t\tif (!closed) return;\n\t\t\t\tresolve(closed instanceof Error ? closed : undefined);\n\t\t\t\tdispose();\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Writes a frame to the group.\n\t * @param frame - The frame to write\n\t */\n\twriteFrame(frame: Uint8Array) {\n\t\tif (this.#state.closed.peek()) throw new Error(\"group is closed\");\n\n\t\tthis.#state.frames.mutate((frames) => {\n\t\t\tframes.push(frame);\n\t\t});\n\n\t\tthis.#state.total.update((total) => total + 1);\n\t}\n\n\t/** Write a string as a single UTF-8 encoded frame. */\n\twriteString(str: string) {\n\t\tthis.writeFrame(new TextEncoder().encode(str));\n\t}\n\n\t/** Write a value as a single JSON-encoded frame. */\n\twriteJson(json: unknown) {\n\t\tthis.writeString(JSON.stringify(json));\n\t}\n\n\t/** Write a boolean as a single one-byte frame. */\n\twriteBool(bool: boolean) {\n\t\tthis.writeFrame(new Uint8Array([bool ? 1 : 0]));\n\t}\n\n\t/** True once no further frames can be read: the group has closed and every buffered frame is read. */\n\tget done(): boolean {\n\t\treturn this.#state.frames.peek().length === 0 && this.#state.closed.peek() !== false;\n\t}\n\n\t/**\n\t * Reads the next already-buffered frame without blocking.\n\t *\n\t * Returns `undefined` when nothing is buffered right now. That is *not* by itself end-of-group:\n\t * check {@link done} to tell \"no frame buffered yet\" (more may arrive) from \"the group finished\".\n\t * Drain a backlog by looping until this returns `undefined`, then branch on {@link done}: if not\n\t * done, {@link readable} resolves when the next frame arrives.\n\t */\n\ttryReadFrame(): Uint8Array | undefined {\n\t\treturn this.tryReadFrameSequence()?.data;\n\t}\n\n\t/** Like {@link tryReadFrame} but also reports the frame's sequence number within the group. */\n\ttryReadFrameSequence(): { sequence: number; data: Uint8Array } | undefined {\n\t\tconst frames = this.#state.frames.peek();\n\t\tconst data = frames.shift();\n\t\tif (data === undefined) return undefined;\n\t\treturn { sequence: this.#state.total.peek() - frames.length - 1, data };\n\t}\n\n\t/**\n\t * Resolves once {@link readFrame} would not block: a frame is buffered, or the group has closed.\n\t * Always settles (never hangs), so on a finished group it resolves immediately; pair it with\n\t * {@link done} to avoid re-waiting on a group that has nothing left.\n\t *\n\t * Lets a caller fold \"this group has a frame\" into a larger wait (e.g. racing it against a new\n\t * group arriving) without touching the group's internal signals.\n\t */\n\tasync readable(): Promise<void> {\n\t\tfor (;;) {\n\t\t\tif (this.#state.frames.peek().length > 0) return;\n\t\t\tif (this.#state.closed.peek()) return;\n\t\t\tawait Signal.race(this.#state.frames, this.#state.closed);\n\t\t}\n\t}\n\n\t/**\n\t * Reads the next frame from the group.\n\t * @returns A promise that resolves to the next frame or undefined\n\t */\n\tasync readFrame(): Promise<Uint8Array | undefined> {\n\t\treturn (await this.readFrameSequence())?.data;\n\t}\n\n\t/** Reads the next frame along with its sequence number within the group. */\n\tasync readFrameSequence(): Promise<{ sequence: number; data: Uint8Array } | undefined> {\n\t\tfor (;;) {\n\t\t\tconst next = this.tryReadFrameSequence();\n\t\t\tif (next) return next;\n\n\t\t\t// Drain buffered frames before observing the close, so a closed group still yields them.\n\t\t\tconst closed = this.#state.closed.peek();\n\t\t\tif (closed instanceof Error) throw closed;\n\t\t\tif (closed) return undefined;\n\n\t\t\tawait this.readable();\n\t\t}\n\t}\n\n\t/** Reads the next frame and decodes it as a UTF-8 string. */\n\tasync readString(): Promise<string | undefined> {\n\t\tconst frame = await this.readFrame();\n\t\treturn frame ? new TextDecoder().decode(frame) : undefined;\n\t}\n\n\t/** Reads the next frame and parses it as JSON. */\n\tasync readJson(): Promise<unknown | undefined> {\n\t\tconst frame = await this.readString();\n\t\treturn frame ? JSON.parse(frame) : undefined;\n\t}\n\n\t/** Reads the next frame and decodes it as a one-byte boolean. */\n\tasync readBool(): Promise<boolean | undefined> {\n\t\tconst frame = await this.readFrame();\n\t\treturn frame ? frame[0] === 1 : undefined;\n\t}\n\n\t/** Closes the group, optionally with an error to abort readers. */\n\tclose(abort?: Error) {\n\t\tthis.#state.closed.set(abort ?? true);\n\t}\n}\n"]}
|
package/group.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.test.d.ts","sourceRoot":"","sources":["../src/group.test.ts"],"names":[],"mappings":""}
|
package/group.test.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* @ts-self-types="./group.test.d.ts" */
|
|
2
|
+
import { expect, test } from "bun:test";
|
|
3
|
+
import { Group } from "./group.js";
|
|
4
|
+
const dec = new TextDecoder();
|
|
5
|
+
test("tryReadFrame drains buffered frames then returns undefined", () => {
|
|
6
|
+
const group = new Group(0);
|
|
7
|
+
group.writeString("a");
|
|
8
|
+
group.writeString("b");
|
|
9
|
+
expect(dec.decode(group.tryReadFrame())).toBe("a");
|
|
10
|
+
expect(dec.decode(group.tryReadFrame())).toBe("b");
|
|
11
|
+
// Nothing buffered: undefined, and the group is not closed so this is not end-of-group.
|
|
12
|
+
expect(group.tryReadFrame()).toBeUndefined();
|
|
13
|
+
});
|
|
14
|
+
test("tryReadFrameSequence reports per-frame sequence numbers", () => {
|
|
15
|
+
const group = new Group(7);
|
|
16
|
+
group.writeString("a");
|
|
17
|
+
group.writeString("b");
|
|
18
|
+
expect(group.tryReadFrameSequence()).toEqual({ sequence: 0, data: new TextEncoder().encode("a") });
|
|
19
|
+
expect(group.tryReadFrameSequence()).toEqual({ sequence: 1, data: new TextEncoder().encode("b") });
|
|
20
|
+
expect(group.tryReadFrameSequence()).toBeUndefined();
|
|
21
|
+
});
|
|
22
|
+
test("done distinguishes a finished group from one that is merely empty", () => {
|
|
23
|
+
const group = new Group(0);
|
|
24
|
+
// Open and empty: not done (more frames may arrive), and tryReadFrame is undefined.
|
|
25
|
+
expect(group.tryReadFrame()).toBeUndefined();
|
|
26
|
+
expect(group.done).toBe(false);
|
|
27
|
+
group.writeString("a");
|
|
28
|
+
// Buffered but closed: still not done until the frame is drained.
|
|
29
|
+
group.close();
|
|
30
|
+
expect(group.done).toBe(false);
|
|
31
|
+
group.tryReadFrame();
|
|
32
|
+
// Drained and closed: now done.
|
|
33
|
+
expect(group.tryReadFrame()).toBeUndefined();
|
|
34
|
+
expect(group.done).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
test("readable resolves once a frame is buffered", async () => {
|
|
37
|
+
const group = new Group(0);
|
|
38
|
+
// No frame yet: readable() must stay pending for an empty, open group.
|
|
39
|
+
const readable = group.readable();
|
|
40
|
+
let settled = false;
|
|
41
|
+
void readable.then(() => {
|
|
42
|
+
settled = true;
|
|
43
|
+
});
|
|
44
|
+
await Promise.resolve();
|
|
45
|
+
expect(settled).toBe(false);
|
|
46
|
+
// Writing makes it resolve.
|
|
47
|
+
group.writeString("hi");
|
|
48
|
+
await readable; // must not hang
|
|
49
|
+
expect(dec.decode(group.tryReadFrame())).toBe("hi");
|
|
50
|
+
});
|
|
51
|
+
test("readable resolves once the group closes, even with nothing buffered", async () => {
|
|
52
|
+
const group = new Group(0);
|
|
53
|
+
const readable = group.readable();
|
|
54
|
+
group.close();
|
|
55
|
+
await readable; // resolves on close so callers don't wait forever
|
|
56
|
+
expect(group.tryReadFrame()).toBeUndefined();
|
|
57
|
+
});
|
|
58
|
+
test("buffered frames are still readable after the group closes", async () => {
|
|
59
|
+
const group = new Group(0);
|
|
60
|
+
group.writeString("a");
|
|
61
|
+
group.close();
|
|
62
|
+
// Closing doesn't discard buffered frames; the blocking reader drains them before ending.
|
|
63
|
+
expect(await group.readString()).toBe("a");
|
|
64
|
+
expect(await group.readFrame()).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=group.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.test.js","sourceRoot":"","sources":["../src/group.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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4B;IAC5B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,QAAQ,CAAC,CAAC,gBAAgB;IAChC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;IACtF,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClC,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,MAAM,QAAQ,CAAC,CAAC,kDAAkD;IAClE,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;IAC5E,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvB,KAAK,CAAC,KAAK,EAAE,CAAC;IAEd,0FAA0F;IAC1F,MAAM,CAAC,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;AACjD,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test } from \"bun:test\";\nimport { Group } from \"./group.ts\";\n\nconst dec = new TextDecoder();\n\ntest(\"tryReadFrame drains buffered frames then returns undefined\", () => {\n\tconst group = new Group(0);\n\tgroup.writeString(\"a\");\n\tgroup.writeString(\"b\");\n\n\texpect(dec.decode(group.tryReadFrame())).toBe(\"a\");\n\texpect(dec.decode(group.tryReadFrame())).toBe(\"b\");\n\t// Nothing buffered: undefined, and the group is not closed so this is not end-of-group.\n\texpect(group.tryReadFrame()).toBeUndefined();\n});\n\ntest(\"tryReadFrameSequence reports per-frame sequence numbers\", () => {\n\tconst group = new Group(7);\n\tgroup.writeString(\"a\");\n\tgroup.writeString(\"b\");\n\n\texpect(group.tryReadFrameSequence()).toEqual({ sequence: 0, data: new TextEncoder().encode(\"a\") });\n\texpect(group.tryReadFrameSequence()).toEqual({ sequence: 1, data: new TextEncoder().encode(\"b\") });\n\texpect(group.tryReadFrameSequence()).toBeUndefined();\n});\n\ntest(\"done distinguishes a finished group from one that is merely empty\", () => {\n\tconst group = new Group(0);\n\t// Open and empty: not done (more frames may arrive), and tryReadFrame is undefined.\n\texpect(group.tryReadFrame()).toBeUndefined();\n\texpect(group.done).toBe(false);\n\n\tgroup.writeString(\"a\");\n\t// Buffered but closed: still not done until the frame is drained.\n\tgroup.close();\n\texpect(group.done).toBe(false);\n\n\tgroup.tryReadFrame();\n\t// Drained and closed: now done.\n\texpect(group.tryReadFrame()).toBeUndefined();\n\texpect(group.done).toBe(true);\n});\n\ntest(\"readable resolves once a frame is buffered\", async () => {\n\tconst group = new Group(0);\n\t// No frame yet: readable() must stay pending for an empty, open group.\n\tconst readable = group.readable();\n\tlet settled = false;\n\tvoid readable.then(() => {\n\t\tsettled = true;\n\t});\n\tawait Promise.resolve();\n\texpect(settled).toBe(false);\n\n\t// Writing makes it resolve.\n\tgroup.writeString(\"hi\");\n\tawait readable; // must not hang\n\texpect(dec.decode(group.tryReadFrame())).toBe(\"hi\");\n});\n\ntest(\"readable resolves once the group closes, even with nothing buffered\", async () => {\n\tconst group = new Group(0);\n\tconst readable = group.readable();\n\tgroup.close();\n\tawait readable; // resolves on close so callers don't wait forever\n\texpect(group.tryReadFrame()).toBeUndefined();\n});\n\ntest(\"buffered frames are still readable after the group closes\", async () => {\n\tconst group = new Group(0);\n\tgroup.writeString(\"a\");\n\tgroup.close();\n\n\t// Closing doesn't discard buffered frames; the blocking reader drains them before ending.\n\texpect(await group.readString()).toBe(\"a\");\n\texpect(await group.readFrame()).toBeUndefined();\n});\n"]}
|
package/ietf/adapter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Stream } from "../stream
|
|
2
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import { Stream } from "../stream";
|
|
2
|
+
import { type IetfVersion } from "./version";
|
|
3
3
|
/**
|
|
4
4
|
* Interface for opening outgoing bidi streams and allocating request IDs.
|
|
5
5
|
* Implemented by both ControlStreamAdapter (v14-v16) and NativeSession (v17).
|
package/ietf/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/ietf/adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,MAAM,EAAe,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,cAAc,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACvB,MAAM,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,aAAc,YAAW,OAAO;;IAG5C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/ietf/adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,MAAM,EAAe,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,cAAc,CAAC;AAEzD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