@caprid/relay 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/README.md +161 -2
- package/dist/connect-session.d.ts +125 -0
- package/dist/connect-session.d.ts.map +1 -0
- package/dist/connect-session.js +300 -0
- package/dist/connect-session.js.map +1 -0
- package/dist/connect.d.ts +143 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +129 -0
- package/dist/connect.js.map +1 -0
- package/dist/delivery-timeouts.d.ts +37 -0
- package/dist/delivery-timeouts.d.ts.map +1 -0
- package/dist/delivery-timeouts.js +48 -0
- package/dist/delivery-timeouts.js.map +1 -0
- package/dist/document-service.d.ts +58 -0
- package/dist/document-service.d.ts.map +1 -0
- package/dist/document-service.js +166 -0
- package/dist/document-service.js.map +1 -0
- package/dist/errors.d.ts +71 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +99 -0
- package/dist/errors.js.map +1 -0
- package/dist/frame-reader.d.ts +81 -0
- package/dist/frame-reader.d.ts.map +1 -0
- package/dist/frame-reader.js +110 -0
- package/dist/frame-reader.js.map +1 -0
- package/dist/frame-writer.d.ts +109 -0
- package/dist/frame-writer.d.ts.map +1 -0
- package/dist/frame-writer.js +409 -0
- package/dist/frame-writer.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/media-track-properties.d.ts +59 -0
- package/dist/media-track-properties.d.ts.map +1 -0
- package/dist/media-track-properties.js +120 -0
- package/dist/media-track-properties.js.map +1 -0
- package/dist/media.d.ts +28 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +28 -0
- package/dist/media.js.map +1 -0
- package/dist/namespace-events.d.ts +44 -0
- package/dist/namespace-events.d.ts.map +1 -0
- package/dist/namespace-events.js +107 -0
- package/dist/namespace-events.js.map +1 -0
- package/dist/node.d.ts +75 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +114 -0
- package/dist/node.js.map +1 -0
- package/dist/payload.d.ts +8 -0
- package/dist/payload.d.ts.map +1 -0
- package/dist/payload.js +23 -0
- package/dist/payload.js.map +1 -0
- package/dist/publish.d.ts +209 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +123 -0
- package/dist/publish.js.map +1 -0
- package/dist/room-endpoint.d.ts +21 -0
- package/dist/room-endpoint.d.ts.map +1 -0
- package/dist/room-endpoint.js +47 -0
- package/dist/room-endpoint.js.map +1 -0
- package/dist/send-order.d.ts +14 -0
- package/dist/send-order.d.ts.map +1 -0
- package/dist/send-order.js +11 -0
- package/dist/send-order.js.map +1 -0
- package/dist/settling-groups.d.ts +35 -0
- package/dist/settling-groups.d.ts.map +1 -0
- package/dist/settling-groups.js +73 -0
- package/dist/settling-groups.js.map +1 -0
- package/dist/subscription-events.d.ts +51 -0
- package/dist/subscription-events.d.ts.map +1 -0
- package/dist/subscription-events.js +125 -0
- package/dist/subscription-events.js.map +1 -0
- package/dist/subscription.d.ts +207 -0
- package/dist/subscription.d.ts.map +1 -0
- package/dist/subscription.js +283 -0
- package/dist/subscription.js.map +1 -0
- package/dist/supervised-publisher.d.ts +92 -0
- package/dist/supervised-publisher.d.ts.map +1 -0
- package/dist/supervised-publisher.js +839 -0
- package/dist/supervised-publisher.js.map +1 -0
- package/dist/supervised-subscriber.d.ts +201 -0
- package/dist/supervised-subscriber.d.ts.map +1 -0
- package/dist/supervised-subscriber.js +1420 -0
- package/dist/supervised-subscriber.js.map +1 -0
- package/dist/supervision.d.ts +78 -0
- package/dist/supervision.d.ts.map +1 -0
- package/dist/supervision.js +149 -0
- package/dist/supervision.js.map +1 -0
- package/dist/switchable.d.ts +164 -0
- package/dist/switchable.d.ts.map +1 -0
- package/dist/switchable.js +327 -0
- package/dist/switchable.js.map +1 -0
- package/dist/validation.d.ts +64 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +137 -0
- package/dist/validation.js.map +1 -0
- package/dist/write-slot.d.ts +87 -0
- package/dist/write-slot.d.ts.map +1 -0
- package/dist/write-slot.js +519 -0
- package/dist/write-slot.js.map +1 -0
- package/package.json +82 -3
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { MOQT_PROTOCOL_IDS, SETUP_OPTION, } from '@caprid/moq-core';
|
|
2
|
+
import { connectedError, connectingError, isCredentialRefusal, RelayError, transportError } from './errors.js';
|
|
3
|
+
/** setTimeout stores its delay in a signed 32-bit integer; a larger one wraps and fires at once. */
|
|
4
|
+
export const MAX_TIMEOUT_MS = 2_147_483_647;
|
|
5
|
+
/**
|
|
6
|
+
* Reject a deadline a timer cannot hold, so a larger number never means a shorter wait. A value
|
|
7
|
+
* that is not a number is a TypeError; a number outside (0, 2147483647] is a RangeError.
|
|
8
|
+
*/
|
|
9
|
+
export function assertTimeoutMs(name, value) {
|
|
10
|
+
if (typeof value !== 'number')
|
|
11
|
+
throw new TypeError(`${name} must be a number of milliseconds`);
|
|
12
|
+
if (!Number.isFinite(value) || value <= 0 || value > MAX_TIMEOUT_MS) {
|
|
13
|
+
throw new RangeError(`${name} must be between 0 (exclusive) and ${MAX_TIMEOUT_MS} milliseconds`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const createBrowserTransport = (url, protocols) => {
|
|
17
|
+
if (typeof WebTransport === 'undefined') {
|
|
18
|
+
throw new RelayError('TRANSPORT_UNAVAILABLE', 'WebTransport is unavailable; in Node, import from @caprid/relay/node (needs @caprid/relay-quic), or supply createTransport with a transport adapter for this runtime', 'connecting');
|
|
19
|
+
}
|
|
20
|
+
// Deno 2.x and Firefox before 155 have a global that ignores protocols and has no protocol getter, so
|
|
21
|
+
// it could never agree on a MOQT version; refuse it here rather than hang waiting for a SETUP that cannot come.
|
|
22
|
+
if (!('protocol' in WebTransport.prototype)) {
|
|
23
|
+
throw new RelayError('TRANSPORT_UNAVAILABLE', 'WebTransport in this runtime cannot negotiate protocols (Firefox needs 155 or later); supply createTransport with a transport adapter for this runtime', 'connecting');
|
|
24
|
+
}
|
|
25
|
+
// TypeScript's DOM lib does not declare `protocol` yet; the prototype check above found it.
|
|
26
|
+
const transport = new WebTransport(url, { protocols });
|
|
27
|
+
return { transport, ready: transport.ready, framing: 'webtransport' };
|
|
28
|
+
};
|
|
29
|
+
const utf8 = new TextEncoder();
|
|
30
|
+
/**
|
|
31
|
+
* The setup options the endpoint URL needs in CLIENT_SETUP for a framing (TA-6). On native QUIC,
|
|
32
|
+
* PATH (the path-abempty and `?query`, the resolved jwt included) and AUTHORITY take the place of
|
|
33
|
+
* the CONNECT request a WebTransport session sends; on a WebTransport session, or a WebSocket whose
|
|
34
|
+
* upgrade request carries the URL as a CONNECT does, neither may be sent (draft-22 §9.1.2, §9.1.1).
|
|
35
|
+
*/
|
|
36
|
+
function endpointSetupOptions(framing, url) {
|
|
37
|
+
if (framing === undefined || framing === 'webtransport' || framing === 'websocket')
|
|
38
|
+
return [];
|
|
39
|
+
if (framing !== 'native-quic')
|
|
40
|
+
throw new RelayError('TRANSPORT_ERROR', `createTransport returned an unknown framing ${JSON.stringify(framing)}; expected 'webtransport', 'native-quic' or 'websocket'`, 'connecting');
|
|
41
|
+
// URL.search is empty for both an absent and an empty query, but `?` with nothing after it is a
|
|
42
|
+
// present, empty query that PATH keeps. A path cannot contain `?` and the endpoint has no
|
|
43
|
+
// fragment, so the query is everything in href from the first `?`.
|
|
44
|
+
const queryStart = url.href.indexOf('?');
|
|
45
|
+
const path = url.pathname + (queryStart === -1 ? '' : url.href.slice(queryStart));
|
|
46
|
+
return [
|
|
47
|
+
{ type: SETUP_OPTION.PATH, value: utf8.encode(path) },
|
|
48
|
+
{ type: SETUP_OPTION.AUTHORITY, value: utf8.encode(url.host) },
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Fail the connection unless the transport negotiated one of the offered protocols, `moqt-22` or `moqt-20` (TA-8). It
|
|
53
|
+
* backs up TA-7, which makes `ready` reject on no selection or an unoffered one; Chromium resolves `ready` anyway, with
|
|
54
|
+
* an empty `protocol`.
|
|
55
|
+
*/
|
|
56
|
+
function assertNegotiatedProtocol(protocol) {
|
|
57
|
+
if (MOQT_PROTOCOL_IDS.includes(protocol))
|
|
58
|
+
return;
|
|
59
|
+
const received = typeof protocol === 'string' && protocol.length > 0 ? JSON.stringify(protocol) : 'none';
|
|
60
|
+
const offered = MOQT_PROTOCOL_IDS.map((id) => `"${id}"`).join(', ');
|
|
61
|
+
throw new RelayError('TRANSPORT_ERROR', `Relay transport negotiated ${received}, not one of the offered protocols ${offered}`, 'connecting');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Internal to the SDK's entry points, never part of the public options: resolves the transport factory in place of
|
|
65
|
+
* `createTransport`, inside the connection's deadline and signal and after the token. `@caprid/relay/node` loads its
|
|
66
|
+
* adapter here. A failure is passed through as it is thrown.
|
|
67
|
+
*/
|
|
68
|
+
export const resolveTransport = Symbol('resolveTransport');
|
|
69
|
+
/**
|
|
70
|
+
* Check an endpoint by the Endpoint rule in spec/behavior.md and return it parsed. Not a string, or
|
|
71
|
+
* not a URL at all (including an https URL with no host), is a TypeError: the wrong shape. A URL
|
|
72
|
+
* that parses but is not one Relay accepts is a RangeError: a disallowed value.
|
|
73
|
+
*/
|
|
74
|
+
export function endpointUrl(endpoint) {
|
|
75
|
+
if (typeof endpoint !== 'string')
|
|
76
|
+
throw new TypeError('Relay endpoints must be a URL string');
|
|
77
|
+
let url;
|
|
78
|
+
try {
|
|
79
|
+
url = new URL(endpoint);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new TypeError('Relay endpoints must be a valid absolute URL', { cause: error });
|
|
83
|
+
}
|
|
84
|
+
if (url.protocol !== 'https:')
|
|
85
|
+
throw new RangeError('Relay endpoints must use HTTPS');
|
|
86
|
+
if (url.hash || url.username || url.password)
|
|
87
|
+
throw new RangeError('Relay endpoints cannot contain fragments or userinfo');
|
|
88
|
+
// A present jwt wins over getToken, so an empty one would connect with no credential at all.
|
|
89
|
+
if (url.searchParams.getAll('jwt').some((value) => value.length === 0))
|
|
90
|
+
throw new RangeError('Relay endpoint has an empty jwt query parameter; put a token in it, or remove it and supply getToken');
|
|
91
|
+
return url;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Shared transport/auth lifetime for the subscribe and publish session drivers. It validates only
|
|
95
|
+
* the shared options; each role checks its own options before calling it.
|
|
96
|
+
*/
|
|
97
|
+
export async function openRelaySession(options, createSession) {
|
|
98
|
+
const url = endpointUrl(options.url);
|
|
99
|
+
const timeoutMs = options.connectTimeoutMs ?? 10_000;
|
|
100
|
+
assertTimeoutMs('connectTimeoutMs', timeoutMs);
|
|
101
|
+
options.signal?.throwIfAborted();
|
|
102
|
+
let transport;
|
|
103
|
+
let session;
|
|
104
|
+
let stopped = false;
|
|
105
|
+
let stopError;
|
|
106
|
+
let rejectConnect;
|
|
107
|
+
let resolveClosed;
|
|
108
|
+
const interrupted = new Promise((_, reject) => {
|
|
109
|
+
rejectConnect = reject;
|
|
110
|
+
});
|
|
111
|
+
const closed = new Promise((resolve) => {
|
|
112
|
+
resolveClosed = resolve;
|
|
113
|
+
});
|
|
114
|
+
const closureObservers = new Set();
|
|
115
|
+
let closedInfo = {};
|
|
116
|
+
const finish = (info = {}) => {
|
|
117
|
+
if (stopped)
|
|
118
|
+
return;
|
|
119
|
+
stopped = true;
|
|
120
|
+
closedInfo = info;
|
|
121
|
+
stopError =
|
|
122
|
+
info.error !== undefined ? info.error : new RelayError('CLOSED', 'Relay connection is closed', 'connection');
|
|
123
|
+
clearTimeout(timer);
|
|
124
|
+
options.signal?.removeEventListener('abort', onAbort);
|
|
125
|
+
// Settle before synchronous user callbacks run during session teardown.
|
|
126
|
+
resolveClosed(info);
|
|
127
|
+
rejectConnect(stopError);
|
|
128
|
+
// Subscriptions hear the closure in this turn. The session fails a pending request before it
|
|
129
|
+
// reports an unexpected closure, so this is how a lost connection is kept from reading as a
|
|
130
|
+
// rejection.
|
|
131
|
+
for (const observer of [...closureObservers])
|
|
132
|
+
observer(info.error);
|
|
133
|
+
closureObservers.clear();
|
|
134
|
+
if (session) {
|
|
135
|
+
session.destroy(info.error);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
try {
|
|
139
|
+
transport?.close();
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// A failed handshake may leave a transport that already refuses close().
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const onAbort = () => finish({ error: options.signal?.reason });
|
|
147
|
+
const timer = setTimeout(() => finish({ error: new RelayError('CONNECTION_TIMEOUT', 'Relay connection timed out', 'connecting') }), timeoutMs);
|
|
148
|
+
options.signal?.addEventListener('abort', onAbort, { once: true });
|
|
149
|
+
const assertOpen = () => {
|
|
150
|
+
if (stopped)
|
|
151
|
+
throw stopError;
|
|
152
|
+
};
|
|
153
|
+
let established = false;
|
|
154
|
+
let usingTransport = false;
|
|
155
|
+
let expiresAt;
|
|
156
|
+
let peerClose;
|
|
157
|
+
// Set in the turn server SETUP arrives, ahead of `established`: a failure in between is no credentials refusal.
|
|
158
|
+
let setupReceived = false;
|
|
159
|
+
const connectFailure = (error) => setupReceived ? transportError(error, 'connecting') : connectingError(error, peerClose);
|
|
160
|
+
const establish = async () => {
|
|
161
|
+
if (!url.searchParams.has('jwt') && options.getToken) {
|
|
162
|
+
const resolved = await options.getToken();
|
|
163
|
+
assertOpen();
|
|
164
|
+
const { token, expiresAt: given } = credential(resolved);
|
|
165
|
+
if (token.length > 0)
|
|
166
|
+
url.searchParams.set('jwt', token);
|
|
167
|
+
expiresAt = given ?? jwtExpiry(token);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
expiresAt = jwtExpiry(url.searchParams.get('jwt') ?? '');
|
|
171
|
+
}
|
|
172
|
+
let createTransport = options.createTransport ?? createBrowserTransport;
|
|
173
|
+
const resolve = options[resolveTransport];
|
|
174
|
+
if (resolve) {
|
|
175
|
+
assertOpen();
|
|
176
|
+
createTransport = await resolve();
|
|
177
|
+
}
|
|
178
|
+
assertOpen();
|
|
179
|
+
usingTransport = true;
|
|
180
|
+
const created = createTransport(url.href, [...MOQT_PROTOCOL_IDS]);
|
|
181
|
+
transport = created.transport;
|
|
182
|
+
// WebTransport.closed may reject alongside ready, before a session can observe it. Registered before the
|
|
183
|
+
// session's own handler, so a peer close is recorded by the time the session reports it.
|
|
184
|
+
void transport.closed.then((info) => {
|
|
185
|
+
peerClose = info;
|
|
186
|
+
}, () => { });
|
|
187
|
+
// A custom factory can synchronously abort before returning its transport.
|
|
188
|
+
if (stopped) {
|
|
189
|
+
void created.ready.catch(() => { });
|
|
190
|
+
try {
|
|
191
|
+
transport.close();
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
// The factory may have closed it while aborting.
|
|
195
|
+
}
|
|
196
|
+
assertOpen();
|
|
197
|
+
}
|
|
198
|
+
await created.ready;
|
|
199
|
+
assertOpen();
|
|
200
|
+
assertNegotiatedProtocol(transport.protocol);
|
|
201
|
+
const setupOptions = endpointSetupOptions(created.framing, url);
|
|
202
|
+
session = createSession(transport, {
|
|
203
|
+
onReady: () => {
|
|
204
|
+
setupReceived = true;
|
|
205
|
+
},
|
|
206
|
+
onClosed: (info) => {
|
|
207
|
+
if (info.error !== undefined) {
|
|
208
|
+
finish({ error: established ? connectedError(info.error, peerClose) : connectFailure(info.error) });
|
|
209
|
+
}
|
|
210
|
+
else if (established && isCredentialRefusal(peerClose)) {
|
|
211
|
+
// The session reports the peer's close without its code; a credentials code ends a live session too.
|
|
212
|
+
finish({ error: connectedError(peerClose) });
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
finish(info);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
onGoaway: () => finish({
|
|
219
|
+
error: new RelayError('GOAWAY', 'Relay requested session migration; open a new connection', established ? 'connection' : 'connecting'),
|
|
220
|
+
}),
|
|
221
|
+
}, setupOptions);
|
|
222
|
+
await session.ready;
|
|
223
|
+
assertOpen();
|
|
224
|
+
return { session, transport };
|
|
225
|
+
};
|
|
226
|
+
let connected;
|
|
227
|
+
try {
|
|
228
|
+
connected = await Promise.race([establish(), interrupted]);
|
|
229
|
+
assertOpen();
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
const failure = stopped ? stopError : usingTransport ? connectFailure(error) : error;
|
|
233
|
+
finish({ error: failure });
|
|
234
|
+
throw failure;
|
|
235
|
+
}
|
|
236
|
+
clearTimeout(timer);
|
|
237
|
+
established = true;
|
|
238
|
+
return {
|
|
239
|
+
session: connected.session,
|
|
240
|
+
closed,
|
|
241
|
+
observeClosed: (observer) => {
|
|
242
|
+
if (stopped) {
|
|
243
|
+
observer(closedInfo.error);
|
|
244
|
+
return () => { };
|
|
245
|
+
}
|
|
246
|
+
closureObservers.add(observer);
|
|
247
|
+
return () => {
|
|
248
|
+
closureObservers.delete(observer);
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
transportClosed: connected.transport.closed,
|
|
252
|
+
// assertNegotiatedProtocol admitted it before the session started.
|
|
253
|
+
protocol: connected.transport.protocol,
|
|
254
|
+
expiresAt,
|
|
255
|
+
assertOpen,
|
|
256
|
+
close: () => finish(),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/** Check what `getToken` returned and split it into the token and its expiry, if given. */
|
|
260
|
+
function credential(resolved) {
|
|
261
|
+
if (resolved === undefined)
|
|
262
|
+
return { token: '' };
|
|
263
|
+
if (typeof resolved === 'string')
|
|
264
|
+
return { token: resolved };
|
|
265
|
+
if (typeof resolved !== 'object' || resolved === null)
|
|
266
|
+
throw new TypeError('getToken must return a string, a RelayCredential or undefined');
|
|
267
|
+
const { token, expiresAt } = resolved;
|
|
268
|
+
if (typeof token !== 'string')
|
|
269
|
+
throw new TypeError('RelayCredential.token must be a string');
|
|
270
|
+
if (!(expiresAt instanceof Date))
|
|
271
|
+
throw new TypeError('RelayCredential.expiresAt must be a Date');
|
|
272
|
+
if (Number.isNaN(expiresAt.getTime()))
|
|
273
|
+
throw new RangeError('RelayCredential.expiresAt is an invalid Date');
|
|
274
|
+
return { token, expiresAt: new Date(expiresAt.getTime()) };
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The `exp` claim of a JWT, read without verifying the token: the relay verifies it, and the SDK only needs to know
|
|
278
|
+
* when the session will end. Anything that is not a JWT with a numeric `exp` has no known expiry.
|
|
279
|
+
*/
|
|
280
|
+
export function jwtExpiry(token) {
|
|
281
|
+
const parts = token.split('.');
|
|
282
|
+
if (parts.length !== 3 || !parts[1])
|
|
283
|
+
return undefined;
|
|
284
|
+
try {
|
|
285
|
+
const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
|
|
286
|
+
const json = new TextDecoder('utf-8', { fatal: true }).decode(Uint8Array.from(atob(base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), '=')), (c) => c.charCodeAt(0)));
|
|
287
|
+
const claims = JSON.parse(json);
|
|
288
|
+
if (typeof claims !== 'object' || claims === null)
|
|
289
|
+
return undefined;
|
|
290
|
+
const { exp } = claims;
|
|
291
|
+
if (typeof exp !== 'number' || !Number.isFinite(exp))
|
|
292
|
+
return undefined;
|
|
293
|
+
const expiresAt = new Date(exp * 1000);
|
|
294
|
+
return Number.isNaN(expiresAt.getTime()) ? undefined : expiresAt;
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=connect-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-session.js","sourceRoot":"","sources":["../src/connect-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAIjB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAAE,UA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AO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC9D,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAC3D,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAC/F,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAChB,CACF,CAAC;QACF,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC;QACpE,MAAM,EAAE,GAAG,EAAE,GAAG,MAA2B,CAAC;QAC5C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QACvE,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type Goaway, type MessageParameters, type MoqTrackSource, type MoqtObject, type PublishDone, type RequestError, type SubscribeOk } from '@caprid/moq-core';
|
|
2
|
+
import { type ConnectRelaySubscriberOptions } from './connect-session.js';
|
|
3
|
+
import { type NamespaceEventOptions, type NamespaceEvents } from './namespace-events.js';
|
|
4
|
+
import { type RelaySubscription } from './subscription.js';
|
|
5
|
+
import { type SubscriptionEventOptions, type SubscriptionEvents } from './subscription-events.js';
|
|
6
|
+
import { type SwitchableHandlers, type SwitchableSubscription } from './switchable.js';
|
|
7
|
+
export type { ConnectRelayOptions, ConnectRelaySubscriberOptions, RelayCredential, RelayTransportFactory, } from './connect-session.js';
|
|
8
|
+
/** Which track to subscribe to, and how: what {@link RelaySubscriber.subscribe} and `subscribeEvents` take. */
|
|
9
|
+
export interface RelayTrackOptions {
|
|
10
|
+
/** Namespace tuple; fields are preserved without splitting or joining on slashes. */
|
|
11
|
+
namespace: readonly string[];
|
|
12
|
+
/** Track name within the namespace. */
|
|
13
|
+
track: string;
|
|
14
|
+
/** Protocol subscription controls, including the location filter and priority. */
|
|
15
|
+
parameters?: MessageParameters;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Callbacks for one subscription made through {@link RelaySubscriber.subscribe}. Each is optional
|
|
19
|
+
* and runs synchronously as the protocol layer delivers the event; the SDK adds no queue. The
|
|
20
|
+
* names say what happened between this connection and the relay. The borrowed
|
|
21
|
+
* {@link RelaySubscriber.trackSource} keeps the core's protocol names (`onOk`, `onDone`) instead.
|
|
22
|
+
*/
|
|
23
|
+
export interface RelaySubscriptionHandlers {
|
|
24
|
+
/**
|
|
25
|
+
* The relay accepted the subscription (SUBSCRIBE_OK) and will forward objects. `info` carries
|
|
26
|
+
* the track alias, the relay's parameters (LARGEST_OBJECT when the track already has content),
|
|
27
|
+
* and the track properties as the relay sends them, which can differ from what the publisher
|
|
28
|
+
* declared.
|
|
29
|
+
*/
|
|
30
|
+
onSubscribed?(info: SubscribeOk): void;
|
|
31
|
+
/**
|
|
32
|
+
* The relay answered the request with REQUEST_ERROR: it rejected the subscription, or the request
|
|
33
|
+
* failed before acceptance (request timeout, or the request stream failing). A REQUEST_ERROR can
|
|
34
|
+
* also arrive after acceptance, for example when the relay refuses an `update()`, and it ends the
|
|
35
|
+
* subscription then too (issue #94). Connection shutdown and GOAWAY never arrive here: a pending
|
|
36
|
+
* subscription ends through `subscribed` and `ended`, and an accepted one surfaces them as
|
|
37
|
+
* subgroup resets and connection closure.
|
|
38
|
+
*/
|
|
39
|
+
onError?(error: RequestError): void;
|
|
40
|
+
/** One object arrived. Payloads are uninterpreted bytes. Objects can arrive after onPublisherDone. */
|
|
41
|
+
onObject?(object: MoqtObject): void;
|
|
42
|
+
/** A subgroup stream finished cleanly (FIN). */
|
|
43
|
+
onSubgroupEnd?(info: {
|
|
44
|
+
groupId: number;
|
|
45
|
+
subgroupId: number;
|
|
46
|
+
endOfGroup: boolean;
|
|
47
|
+
}): void;
|
|
48
|
+
/**
|
|
49
|
+
* A subgroup stream was reset; objects from it may be missing. Called for every reset the relay
|
|
50
|
+
* forwards. The relay may drop a reset for a subgroup it had not begun forwarding, so an abandoned
|
|
51
|
+
* group can arrive as nothing at all, only a gap in group IDs.
|
|
52
|
+
*/
|
|
53
|
+
onSubgroupReset?(info: {
|
|
54
|
+
groupId: number;
|
|
55
|
+
error: unknown;
|
|
56
|
+
}): void;
|
|
57
|
+
/**
|
|
58
|
+
* The publisher finished with the track (PUBLISH_DONE). This is a control notification, not the
|
|
59
|
+
* end of the subscription: objects still in transit can arrive after it, and the request stays
|
|
60
|
+
* open until `cancel()` or connection shutdown. The SDK does not resubscribe, and resubscribing
|
|
61
|
+
* cannot bring back a finished track: against moq-relay, a subscribe after the publisher has gone
|
|
62
|
+
* is refused (request error 16 `unroutable`), and one while its namespace stays announced replays
|
|
63
|
+
* the track's cached last group and another done one round trip later. Back off, and do not
|
|
64
|
+
* resubscribe to a track the publisher ended. A done that follows this subscription's own
|
|
65
|
+
* `update()` is different: moq-relay ends the subscription on any update, the track is still live,
|
|
66
|
+
* and resubscribing is how to apply the change. After a publisher crash the done arrives only at
|
|
67
|
+
* the relay's QUIC idle timeout, about 11 s later on moq-relay 0.17.0. See spec/relay-interop.md,
|
|
68
|
+
* "Publisher restarts".
|
|
69
|
+
*/
|
|
70
|
+
onPublisherDone?(info: PublishDone): void;
|
|
71
|
+
/**
|
|
72
|
+
* The relay acknowledged an `update()` on this subscription (REQUEST_OK). moq-relay never does: it
|
|
73
|
+
* ends the subscription with PUBLISH_DONE on any update (spec/behavior.md, relay interop
|
|
74
|
+
* deviation 4).
|
|
75
|
+
*/
|
|
76
|
+
onUpdateOk?(): void;
|
|
77
|
+
/**
|
|
78
|
+
* The publisher changed the subscription's state on its own (PUBLISH_STATE_NOTIFY); `parameters`
|
|
79
|
+
* carries only what changed. Informational.
|
|
80
|
+
*/
|
|
81
|
+
onStateNotify?(parameters: MessageParameters): void;
|
|
82
|
+
/**
|
|
83
|
+
* GOAWAY on this request stream: the relay wants this request re-issued, possibly elsewhere. A
|
|
84
|
+
* GOAWAY on the connection itself ends the connection instead; observe `closed` for that.
|
|
85
|
+
*/
|
|
86
|
+
onGoaway?(goaway: Goaway): void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A connection that can only subscribe. Create one with {@link connectRelaySubscriber}. Publishing
|
|
90
|
+
* uses a separate connection and token; see `connectRelayPublisher`.
|
|
91
|
+
*/
|
|
92
|
+
export interface RelaySubscriber {
|
|
93
|
+
/**
|
|
94
|
+
* Ask the relay for a track's objects, in any payload format, without discovering or loading a
|
|
95
|
+
* catalog. Returns at once with a cancellable handle whose `subscribed` settles when the relay
|
|
96
|
+
* answers and whose `ended` settles once the subscription can no longer deliver;
|
|
97
|
+
* `handlers.onSubscribed` and `handlers.onError` report the same answer as callbacks.
|
|
98
|
+
*/
|
|
99
|
+
subscribe(options: RelayTrackOptions, handlers?: RelaySubscriptionHandlers): RelaySubscription;
|
|
100
|
+
/**
|
|
101
|
+
* Subscribe to a track through a handle that can move to another track in the same namespace
|
|
102
|
+
* make-before-break: `switchTo` opens the new subscription while this one keeps delivering, and
|
|
103
|
+
* cuts over once the new one's object passes `until`. Use it to change layers (simulcast, ABR), or
|
|
104
|
+
* to change a subscription's filter or priority, which `update()` cannot do against moq-relay.
|
|
105
|
+
* Handlers see only the active subscription, with its track name.
|
|
106
|
+
*/
|
|
107
|
+
subscribeSwitchable(options: RelayTrackOptions, handlers?: SwitchableHandlers): SwitchableSubscription;
|
|
108
|
+
/** Bounded async events. Owns its subscription; break/return cancels it. */
|
|
109
|
+
subscribeEvents(options: RelayTrackOptions, buffer?: SubscriptionEventOptions): SubscriptionEvents;
|
|
110
|
+
/**
|
|
111
|
+
* Discover which namespaces under a prefix are announced, as bounded async events with the same
|
|
112
|
+
* ownership rules as `subscribeEvents`: the iterator owns one SUBSCRIBE_NAMESPACE request, and
|
|
113
|
+
* break/return, `close()` or the signal cancels it. It first yields `announced` for each namespace
|
|
114
|
+
* already announced, then one event per announce and withdrawal. The relay sends no marker between
|
|
115
|
+
* the two. A relay rejection ends it with `SubscriptionRequestError`, the connection ending with
|
|
116
|
+
* `SubscriptionConnectionClosedError`, a full queue with `SubscriptionOverflowError`; a relay that
|
|
117
|
+
* finishes the request ends it cleanly. See spec/behavior.md, "Discovery", for the timing.
|
|
118
|
+
*/
|
|
119
|
+
namespaceEvents(options: NamespaceEventOptions): NamespaceEvents;
|
|
120
|
+
/**
|
|
121
|
+
* This connection seen through the generic `MoqTrackSource` contract, for integrations such as
|
|
122
|
+
* players: `subscribe`, `fetch`, and `trackStatus` in protocol terms, plus `closed`. It lists no
|
|
123
|
+
* tracks and cannot close the connection; the application that opened the connection owns
|
|
124
|
+
* shutdown.
|
|
125
|
+
*/
|
|
126
|
+
readonly trackSource: MoqTrackSource;
|
|
127
|
+
/** Resolves once for local shutdown, peer closure, or failure. It never rejects. */
|
|
128
|
+
readonly closed: Promise<{
|
|
129
|
+
/** The failure that ended the connection; absent after a clean shutdown. */
|
|
130
|
+
error?: unknown;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* When the relay will end this connection for its credential's expiry: the `RelayCredential`'s `expiresAt`, or the
|
|
134
|
+
* JWT's `exp` claim, read without verifying it. `undefined` when neither is known. The relay closes the session then
|
|
135
|
+
* with `UNAUTHORIZED` in phase `connection`; open a replacement before it. Supervised connections do.
|
|
136
|
+
*/
|
|
137
|
+
readonly expiresAt: Date | undefined;
|
|
138
|
+
/** Close this connection and all requests on it. Idempotent. */
|
|
139
|
+
close(): void;
|
|
140
|
+
}
|
|
141
|
+
/** Open a Relay connection for subscribing to tracks. The caller owns connection shutdown. */
|
|
142
|
+
export declare function connectRelaySubscriber(options: ConnectRelaySubscriberOptions): Promise<RelaySubscriber>;
|
|
143
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAmB,KAAK,6BAA6B,EAAoB,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAyB,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAE5B,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,+GAA+G;AAC/G,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kF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MAAM,CAAC,EAAE,wBAAwB,GAAG,kBAAkB,CAAC;IACnG;;;;;;;;OAQG;IACH,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAAC;IACjE;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IACrC,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,4EAA4E;QAC5E,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC,CAAC;IACH;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IACrC,gEAAgE;IAChE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,8FAA8F;AAC9F,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,eAAe,CAAC,CAgH7G"}
|
package/dist/connect.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createMoqtSession, SETUP_OPTION, } from '@caprid/moq-core';
|
|
2
|
+
import { assertTimeoutMs, openRelaySession } from './connect-session.js';
|
|
3
|
+
import { createNamespaceEvents } from './namespace-events.js';
|
|
4
|
+
import { createSubscription, synchronousCallback, } from './subscription.js';
|
|
5
|
+
import { createSubscriptionEvents, } from './subscription-events.js';
|
|
6
|
+
import { createSwitchable, snapshotSwitchableHandlers, } from './switchable.js';
|
|
7
|
+
import { namespaceFields, trackName } from './validation.js';
|
|
8
|
+
/** Open a Relay connection for subscribing to tracks. The caller owns connection shutdown. */
|
|
9
|
+
export async function connectRelaySubscriber(options) {
|
|
10
|
+
// The request deadline is subscriber-only, so the subscriber checks it; the shared opener checks
|
|
11
|
+
// the rest before anything connects.
|
|
12
|
+
assertTimeoutMs('requestTimeoutMs', options.requestTimeoutMs ?? 10_000);
|
|
13
|
+
const { session: connected, closed, observeClosed, assertOpen, close, protocol, expiresAt, } = await openRelaySession(options, (transport, callbacks, setupOptions) => createMoqtSession(transport, {
|
|
14
|
+
implementationName: '@caprid/relay',
|
|
15
|
+
// Namespaces arrive only on a namespaceEvents request, never pushed unasked (spec/behavior.md, "Discovery").
|
|
16
|
+
setupOptions: [...setupOptions, { type: SETUP_OPTION.SOLICIT, value: 1 }],
|
|
17
|
+
requestTimeoutMs: options.requestTimeoutMs,
|
|
18
|
+
callbacks,
|
|
19
|
+
}));
|
|
20
|
+
/** Prefixes with a namespace request open on this connection (namespace-events.ts, `claimPrefix`). */
|
|
21
|
+
const prefixes = new Set();
|
|
22
|
+
const trackSource = Object.freeze({
|
|
23
|
+
closed,
|
|
24
|
+
subscribe: (options, handlers) => {
|
|
25
|
+
// Arguments before connection state, as on the product entry points.
|
|
26
|
+
const trackNamespace = namespaceFields(options.trackNamespace);
|
|
27
|
+
const name = trackName(options.trackName);
|
|
28
|
+
assertOpen();
|
|
29
|
+
return connected.subscribe({ ...options, trackNamespace, trackName: name }, handlers);
|
|
30
|
+
},
|
|
31
|
+
fetch: (...args) => {
|
|
32
|
+
assertOpen();
|
|
33
|
+
return connected.fetch(...args);
|
|
34
|
+
},
|
|
35
|
+
trackStatus: (...args) => {
|
|
36
|
+
assertOpen();
|
|
37
|
+
return connected.trackStatus(...args);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Admit the arguments of one public call: checked and copied first, then the connection state.
|
|
42
|
+
* Both entry points do this synchronously, before anything (an iterator, a subscription) exists.
|
|
43
|
+
*/
|
|
44
|
+
const admit = ({ namespace, track, parameters }) => {
|
|
45
|
+
const trackNamespace = namespaceFields(namespace);
|
|
46
|
+
const name = trackName(track);
|
|
47
|
+
assertOpen();
|
|
48
|
+
return { trackNamespace, trackName: name, parameters };
|
|
49
|
+
};
|
|
50
|
+
/** One product subscription per public call; both entry points bind the core the same way. */
|
|
51
|
+
const subscription = (admitted, consumers) => createSubscription({ subscribe: (handlers) => connected.subscribe(admitted, handlers), protocol, observeClosed }, consumers);
|
|
52
|
+
return {
|
|
53
|
+
closed,
|
|
54
|
+
expiresAt: expiresAt === undefined ? undefined : new Date(expiresAt.getTime()),
|
|
55
|
+
trackSource,
|
|
56
|
+
subscribe: (options, handlers) => {
|
|
57
|
+
// Every argument (the handlers' shape included) before connection state.
|
|
58
|
+
const consumers = handlers ? [handlersConsumer(handlers)] : [];
|
|
59
|
+
return subscription(admit(options), consumers);
|
|
60
|
+
},
|
|
61
|
+
subscribeSwitchable: (options, handlers) => {
|
|
62
|
+
// Every argument (the handlers' shape included) before connection state.
|
|
63
|
+
const snapshot = snapshotSwitchableHandlers(handlers);
|
|
64
|
+
const { trackNamespace, trackName: track, parameters } = admit(options);
|
|
65
|
+
return createSwitchable({
|
|
66
|
+
subscribe: (name, params, consumer) => subscription(admit({
|
|
67
|
+
namespace: trackNamespace,
|
|
68
|
+
track: name,
|
|
69
|
+
...(params === undefined ? {} : { parameters: params }),
|
|
70
|
+
}), [consumer]),
|
|
71
|
+
}, track, parameters, snapshot);
|
|
72
|
+
},
|
|
73
|
+
subscribeEvents: (options, buffer) => {
|
|
74
|
+
// Admit before building the iterator: an already-aborted signal never runs its callback.
|
|
75
|
+
const admitted = admit(options);
|
|
76
|
+
return createSubscriptionEvents((consumer) => subscription(admitted, [consumer]), buffer);
|
|
77
|
+
},
|
|
78
|
+
namespaceEvents: (options) => {
|
|
79
|
+
// Options are read once and checked before connection state, as on the other entry points.
|
|
80
|
+
if (typeof options !== 'object' || options === null)
|
|
81
|
+
throw new TypeError('namespaceEvents takes an options object');
|
|
82
|
+
const { prefix: given, capacity, signal } = options;
|
|
83
|
+
const prefix = namespaceFields(given);
|
|
84
|
+
assertOpen();
|
|
85
|
+
return createNamespaceEvents({ subscribeNamespace: (...args) => connected.subscribeNamespace(...args), observeClosed, prefixes }, prefix, { ...(capacity === undefined ? {} : { capacity }), ...(signal === undefined ? {} : { signal }) });
|
|
86
|
+
},
|
|
87
|
+
close,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Which product handler each product event reaches. */
|
|
91
|
+
const EVENT_HANDLERS = {
|
|
92
|
+
subscribed: 'onSubscribed',
|
|
93
|
+
object: 'onObject',
|
|
94
|
+
publisherDone: 'onPublisherDone',
|
|
95
|
+
subgroupEnd: 'onSubgroupEnd',
|
|
96
|
+
subgroupReset: 'onSubgroupReset',
|
|
97
|
+
stateNotify: 'onStateNotify',
|
|
98
|
+
goaway: 'onGoaway',
|
|
99
|
+
updateOk: 'onUpdateOk',
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The callback form as one consumer: snapshot the product callbacks at subscribe time, hold them to
|
|
103
|
+
* the synchronous callback policy, and dispatch each product event to the handler of the same
|
|
104
|
+
* meaning. A REQUEST_ERROR ending reaches `onError`; other endings reach nothing until issue #68.
|
|
105
|
+
*/
|
|
106
|
+
function handlersConsumer(handlers) {
|
|
107
|
+
const snapshot = new Map();
|
|
108
|
+
for (const name of [...Object.values(EVENT_HANDLERS), 'onError']) {
|
|
109
|
+
const callback = handlers[name];
|
|
110
|
+
if (callback)
|
|
111
|
+
snapshot.set(name, synchronousCallback(name, callback, handlers));
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
event(event) {
|
|
115
|
+
const callback = snapshot.get(EVENT_HANDLERS[event.type]);
|
|
116
|
+
if (!callback)
|
|
117
|
+
return;
|
|
118
|
+
if (event.type === 'updateOk')
|
|
119
|
+
callback();
|
|
120
|
+
else
|
|
121
|
+
callback(event.value);
|
|
122
|
+
},
|
|
123
|
+
ended(end) {
|
|
124
|
+
if (end.cause === 'request-error')
|
|
125
|
+
snapshot.get('onError')?.(end.error);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EASjB,YAAY,GAGb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EA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QAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,QAAQ;YAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAClF,CAAC;IACD,OAAO;QACL,KAAK,CAAC,KAAK;YACT,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC,QAAQ;gBAAE,OAAO;YACtB,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;gBAAE,QAAQ,EAAE,CAAC;;gBACrC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,GAAG;YACP,IAAI,GAAG,CAAC,KAAK,KAAK,eAAe;gBAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delivery timeouts (see CONTEXT.md): the draft's SUBGROUP_DELIVERY_TIMEOUT and OBJECT_DELIVERY_TIMEOUT, as the write
|
|
3
|
+
* slot applies them to one group (draft-ietf-moq-transport-22 §5.2).
|
|
4
|
+
*
|
|
5
|
+
* Each side has a value for each timeout. The publisher's is the property (0x02 or 0x06) on the group's first object
|
|
6
|
+
* when present, and the track property otherwise; the subscriber's is the parameter on the relay subscription, as
|
|
7
|
+
* updated by REQUEST_UPDATE. The group uses the smaller of the two when both are non-zero, and the non-zero one
|
|
8
|
+
* otherwise. 0 means no timeout. Nothing here rejects a value: a byte value is ignored, and a value above the timer
|
|
9
|
+
* bound is clamped to it.
|
|
10
|
+
*/
|
|
11
|
+
import type { KeyValuePair, MessageParameters } from '@caprid/moq-core';
|
|
12
|
+
/** One side's delivery timeouts, or a group's effective ones, in milliseconds. 0 means no timeout. */
|
|
13
|
+
export interface DeliveryTimeouts {
|
|
14
|
+
/** OBJECT_DELIVERY_TIMEOUT: the most an object may age before it reaches the transport. */
|
|
15
|
+
objectMs: number;
|
|
16
|
+
/** SUBGROUP_DELIVERY_TIMEOUT: the most a group may wait, from its FIN, for the relay's acknowledgment. */
|
|
17
|
+
subgroupMs: number;
|
|
18
|
+
}
|
|
19
|
+
/** Property and parameter type of OBJECT_DELIVERY_TIMEOUT (§9.20.4, §10.2). */
|
|
20
|
+
export declare const OBJECT_DELIVERY_TIMEOUT = 2;
|
|
21
|
+
/** Property and parameter type of SUBGROUP_DELIVERY_TIMEOUT (§9.20.3, §10.1). */
|
|
22
|
+
export declare const SUBGROUP_DELIVERY_TIMEOUT = 6;
|
|
23
|
+
/** No timeout of either kind. */
|
|
24
|
+
export declare const NO_DELIVERY_TIMEOUTS: DeliveryTimeouts;
|
|
25
|
+
/**
|
|
26
|
+
* The publisher's values for a group: each timeout from the group's first object's properties when present there,
|
|
27
|
+
* and from the track's otherwise (§5.2). Pass the track's own values as `fallback`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function publisherTimeouts(properties: readonly KeyValuePair[], fallback?: DeliveryTimeouts): DeliveryTimeouts;
|
|
30
|
+
/**
|
|
31
|
+
* A subscription's values after `parameters`: each timeout the message carries replaces the previous one, and an
|
|
32
|
+
* absent one keeps it (§9.5: a parameter not present in REQUEST_UPDATE keeps its value).
|
|
33
|
+
*/
|
|
34
|
+
export declare function subscriberTimeouts(parameters: MessageParameters, previous?: DeliveryTimeouts): DeliveryTimeouts;
|
|
35
|
+
/** A group's effective timeouts from the publisher's and the subscriber's values (§5.2). */
|
|
36
|
+
export declare function effectiveTimeouts(publisher: DeliveryTimeouts, subscriber: DeliveryTimeouts): DeliveryTimeouts;
|
|
37
|
+
//# sourceMappingURL=delivery-timeouts.d.ts.map
|