@voxevolv/client 0.3.17 → 0.3.18
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/CHANGELOG.md +14 -1
- package/dist/browser/index.js +6 -6
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/index.js.sha384 +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +4 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +2 -2
- package/dist/presentations.d.ts +3 -1
- package/dist/presentations.d.ts.map +1 -1
- package/dist/presentations.js +35 -6
- package/dist/presentations.js.map +1 -1
- package/dist/vendor/livekit-client.esm.mjs +71 -9
- package/package.json +2 -2
package/dist/presentations.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ClientDiagnosticInput } from "./diagnostics.js";
|
|
1
2
|
type SendRpc = (request: {
|
|
2
3
|
destinationIdentity: string;
|
|
3
4
|
method: string;
|
|
@@ -9,8 +10,9 @@ export declare class Presentations {
|
|
|
9
10
|
private readonly send;
|
|
10
11
|
private readonly isClosed;
|
|
11
12
|
private readonly receiptFailed;
|
|
13
|
+
private readonly observe?;
|
|
12
14
|
private readonly results;
|
|
13
|
-
constructor(send: SendRpc, isClosed: () => boolean, receiptFailed: () => void);
|
|
15
|
+
constructor(send: SendRpc, isClosed: () => boolean, receiptFailed: () => void, observe?: ((entry: ClientDiagnosticInput) => void) | undefined);
|
|
14
16
|
invoke(id: string, worker: string, execute: () => Promise<string>): Promise<string>;
|
|
15
17
|
private execute;
|
|
16
18
|
private complete;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentations.d.ts","sourceRoot":"","sources":["../src/presentations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presentations.d.ts","sourceRoot":"","sources":["../src/presentations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAM9D,KAAK,OAAO,GAAG,CAAC,OAAO,EAAE;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAItB,qFAAqF;AACrF,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAN3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyC;IAEjE,YACmB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,OAAO,EACvB,aAAa,EAAE,MAAM,IAAI,EACzB,OAAO,CAAC,GAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,aAAA,EAC/D;IAEJ,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlF;YAEa,OAAO;IAuCrB,OAAO,CAAC,QAAQ;YAQF,OAAO;CA+BtB"}
|
package/dist/presentations.js
CHANGED
|
@@ -7,11 +7,13 @@ export class Presentations {
|
|
|
7
7
|
send;
|
|
8
8
|
isClosed;
|
|
9
9
|
receiptFailed;
|
|
10
|
+
observe;
|
|
10
11
|
results = new Map();
|
|
11
|
-
constructor(send, isClosed, receiptFailed) {
|
|
12
|
+
constructor(send, isClosed, receiptFailed, observe) {
|
|
12
13
|
this.send = send;
|
|
13
14
|
this.isClosed = isClosed;
|
|
14
15
|
this.receiptFailed = receiptFailed;
|
|
16
|
+
this.observe = observe;
|
|
15
17
|
}
|
|
16
18
|
invoke(id, worker, execute) {
|
|
17
19
|
const key = JSON.stringify([worker, id]);
|
|
@@ -81,11 +83,38 @@ export class Presentations {
|
|
|
81
83
|
this.receiptFailed();
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
|
-
request(id, worker, payload) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
async request(id, worker, payload) {
|
|
87
|
+
const startedAt = performance.now();
|
|
88
|
+
const record = (entry) => {
|
|
89
|
+
try {
|
|
90
|
+
this.observe?.({
|
|
91
|
+
operation: "tool_rpc", status: "started", tool_name: "present_attachment",
|
|
92
|
+
presentation_id: id, timeout_ms: 2_000,
|
|
93
|
+
reason: payload.action === "claim" ? "presentation_claim" : "presentation_complete",
|
|
94
|
+
duration_ms: performance.now() - startedAt, ...entry,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Optional diagnostics must not change authorization or display behavior.
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
record({ stage: "publish_started" });
|
|
102
|
+
try {
|
|
103
|
+
const response = await this.send({
|
|
104
|
+
destinationIdentity: worker, method: PRESENTATION_METHOD,
|
|
105
|
+
payload: JSON.stringify({ operation_id: id, ...payload }), responseTimeout: 2_000,
|
|
106
|
+
});
|
|
107
|
+
record({ stage: "received", status: "succeeded" });
|
|
108
|
+
return response;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
// npm's patched transport and this module can load distinct RpcError
|
|
112
|
+
// classes. Read the numeric code without relying on constructor identity.
|
|
113
|
+
const rpcErrorCode = error && typeof error === "object" && "code" in error
|
|
114
|
+
&& typeof error.code === "number" ? error.code : undefined;
|
|
115
|
+
record({ status: "failed", rpc_error_code: rpcErrorCode });
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
89
118
|
}
|
|
90
119
|
}
|
|
91
120
|
//# sourceMappingURL=presentations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentations.js","sourceRoot":"","sources":["../src/presentations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"presentations.js","sourceRoot":"","sources":["../src/presentations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AACpD,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAWhC,qFAAqF;AACrF,MAAM,OAAO,aAAa;IAIL,IAAI;IACJ,QAAQ;IACR,aAAa;IACb,OAAO;IANT,OAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;IAEjE,YACmB,IAAa,EACb,QAAuB,EACvB,aAAyB,EACzB,OAAgD;oBAHhD,IAAI;wBACJ,QAAQ;6BACR,aAAa;uBACb,OAAO;IACvB,CAAC;IAEJ,MAAM,CAAC,EAAU,EAAE,MAAc,EAAE,OAA8B;QAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC,QAAQ,CAAC;QACvC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,wBAAwB,EAAE,CAAC;YAClD,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnE,IAAI,CAAC,OAAO;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,QAAQ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,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,eAAe,EAAE,KAAK;aAClF,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;YACnD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,qEAAqE;YACrE,0EAA0E;YAC1E,MAAM,YAAY,GAAG,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;mBACrE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7D,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAC;YAC3D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -16348,7 +16348,7 @@ class SignalClient {
|
|
|
16348
16348
|
}();
|
|
16349
16349
|
});
|
|
16350
16350
|
}
|
|
16351
|
-
reconnect(url, token, sid, reason) {
|
|
16351
|
+
reconnect(url, token, sid, reason, abortSignal) {
|
|
16352
16352
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16353
16353
|
if (!this.options) {
|
|
16354
16354
|
this.log.warn('attempted to reconnect without signal options being set, ignoring');
|
|
@@ -16361,7 +16361,7 @@ class SignalClient {
|
|
|
16361
16361
|
reconnect: true,
|
|
16362
16362
|
sid,
|
|
16363
16363
|
reconnectReason: reason
|
|
16364
|
-
}),
|
|
16364
|
+
}), abortSignal, this.useV0SignalPath);
|
|
16365
16365
|
return res;
|
|
16366
16366
|
});
|
|
16367
16367
|
}
|
|
@@ -16425,6 +16425,10 @@ class SignalClient {
|
|
|
16425
16425
|
reconnect: opts.reconnect,
|
|
16426
16426
|
reconnectReason: opts.reconnectReason
|
|
16427
16427
|
});
|
|
16428
|
+
if (abortSignal?.aborted) {
|
|
16429
|
+
yield abortHandler(abortSignal);
|
|
16430
|
+
return;
|
|
16431
|
+
}
|
|
16428
16432
|
this.ws = new WebSocketStream(rtcUrl);
|
|
16429
16433
|
try {
|
|
16430
16434
|
this.ws.closed.then(closeInfo => {
|
|
@@ -16471,6 +16475,10 @@ class SignalClient {
|
|
|
16471
16475
|
return;
|
|
16472
16476
|
}));
|
|
16473
16477
|
clearTimeout(wsTimeout);
|
|
16478
|
+
if (abortSignal?.aborted) {
|
|
16479
|
+
yield abortHandler(abortSignal);
|
|
16480
|
+
return;
|
|
16481
|
+
}
|
|
16474
16482
|
if (!connection) {
|
|
16475
16483
|
return;
|
|
16476
16484
|
}
|
|
@@ -16478,6 +16486,10 @@ class SignalClient {
|
|
|
16478
16486
|
this.streamWriter = connection.writable.getWriter();
|
|
16479
16487
|
const firstMessage = yield signalReader.read();
|
|
16480
16488
|
signalReader.releaseLock();
|
|
16489
|
+
if (abortSignal?.aborted) {
|
|
16490
|
+
yield abortHandler(abortSignal);
|
|
16491
|
+
return;
|
|
16492
|
+
}
|
|
16481
16493
|
if (!firstMessage.value) {
|
|
16482
16494
|
throw ConnectionError.internal('no message received as first message');
|
|
16483
16495
|
}
|
|
@@ -21093,6 +21105,38 @@ var DataChannelKind;
|
|
|
21093
21105
|
// `0` means "no limit".
|
|
21094
21106
|
const DEFAULT_MAX_MESSAGE_SIZE = 64000;
|
|
21095
21107
|
/** @internal */
|
|
21108
|
+
|
|
21109
|
+
function voxevolvAssertEngineOpen(engine) {
|
|
21110
|
+
if (engine.voxevolvCloseController.signal.aborted) {
|
|
21111
|
+
throw new UnexpectedConnectionState('Engine was discarded');
|
|
21112
|
+
}
|
|
21113
|
+
}
|
|
21114
|
+
|
|
21115
|
+
async function voxevolvUntilEngineClosed(engine, callerSignal, operation) {
|
|
21116
|
+
voxevolvAssertEngineOpen(engine);
|
|
21117
|
+
if (callerSignal?.aborted) throw ConnectionError.cancelled('Connection aborted');
|
|
21118
|
+
const lifetime = engine.voxevolvCloseController.signal;
|
|
21119
|
+
const controller = new AbortController();
|
|
21120
|
+
let cancel;
|
|
21121
|
+
const cancelled = new Promise((_, reject) => {
|
|
21122
|
+
cancel = () => {
|
|
21123
|
+
controller.abort();
|
|
21124
|
+
reject(lifetime.aborted
|
|
21125
|
+
? new UnexpectedConnectionState('Engine was discarded')
|
|
21126
|
+
: ConnectionError.cancelled('Connection aborted'));
|
|
21127
|
+
};
|
|
21128
|
+
lifetime.addEventListener('abort', cancel, { once: true });
|
|
21129
|
+
callerSignal?.addEventListener('abort', cancel, { once: true });
|
|
21130
|
+
});
|
|
21131
|
+
try {
|
|
21132
|
+
// Abort the transport and stop waiting even if it returns a late response.
|
|
21133
|
+
return await Promise.race([operation(controller.signal), cancelled]);
|
|
21134
|
+
} finally {
|
|
21135
|
+
lifetime.removeEventListener('abort', cancel);
|
|
21136
|
+
callerSignal?.removeEventListener('abort', cancel);
|
|
21137
|
+
}
|
|
21138
|
+
}
|
|
21139
|
+
|
|
21096
21140
|
class RTCEngine extends eventsExports.EventEmitter {
|
|
21097
21141
|
get isClosed() {
|
|
21098
21142
|
return this._isClosed;
|
|
@@ -21118,6 +21162,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21118
21162
|
this.pcState = PCState.New;
|
|
21119
21163
|
this._isClosed = true;
|
|
21120
21164
|
this._isNewlyCreated = true;
|
|
21165
|
+
this.voxevolvCloseController = new AbortController();
|
|
21121
21166
|
this.pendingTrackResolvers = {};
|
|
21122
21167
|
this.reconnectAttempts = 0;
|
|
21123
21168
|
this.reconnectStart = 0;
|
|
@@ -21274,7 +21319,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21274
21319
|
// continues to work, we can reconnect to websocket to continue the session
|
|
21275
21320
|
// after a number of retries, we'll close and give up permanently
|
|
21276
21321
|
this.handleDisconnect = (connection, disconnectReason) => {
|
|
21277
|
-
if (this._isClosed) {
|
|
21322
|
+
if (this._isClosed || this.voxevolvCloseController.signal.aborted) {
|
|
21278
21323
|
return;
|
|
21279
21324
|
}
|
|
21280
21325
|
try { this.voxevolvObserveConnection?.({
|
|
@@ -21441,6 +21486,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21441
21486
|
let useV0Path = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
21442
21487
|
return function* () {
|
|
21443
21488
|
var _a, _b, _c;
|
|
21489
|
+
voxevolvAssertEngineOpen(_this2);
|
|
21444
21490
|
_this2._isNewlyCreated = false;
|
|
21445
21491
|
_this2.url = url;
|
|
21446
21492
|
_this2.token = token;
|
|
@@ -21462,6 +21508,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21462
21508
|
// createInitialOffer() defers setLocalDescription (via pendingInitialOffer) until the
|
|
21463
21509
|
// answer is applied, after updateConfiguration() has set the server's TURN servers.
|
|
21464
21510
|
yield _this2.configure();
|
|
21511
|
+
voxevolvAssertEngineOpen(_this2);
|
|
21465
21512
|
_this2.applyInitialPublisherLayout();
|
|
21466
21513
|
}
|
|
21467
21514
|
const offer = yield (_a = _this2.pcManager) === null || _a === void 0 ? void 0 : _a.publisher.createInitialOffer();
|
|
@@ -21476,7 +21523,9 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21476
21523
|
_this2.shouldFailOnV1Path = false;
|
|
21477
21524
|
throw ConnectionError.serviceNotFound('Simulated v1 path failure', 'v0-rtc');
|
|
21478
21525
|
}
|
|
21479
|
-
const joinResponse = yield _this2
|
|
21526
|
+
const joinResponse = yield voxevolvUntilEngineClosed(_this2, abortSignal,
|
|
21527
|
+
signal => _this2.client.join(url, token, opts, signal, useV0Path, offerProto));
|
|
21528
|
+
voxevolvAssertEngineOpen(_this2);
|
|
21480
21529
|
_this2._isClosed = false;
|
|
21481
21530
|
_this2.latestJoinResponse = joinResponse;
|
|
21482
21531
|
_this2.participantSid = (_b = joinResponse.participant) === null || _b === void 0 ? void 0 : _b.sid;
|
|
@@ -21489,6 +21538,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21489
21538
|
// the server's ICE servers and topology, then negotiate separately rather than bundling
|
|
21490
21539
|
// the offer with the join.
|
|
21491
21540
|
yield _this2.configure(joinResponse, !useV0Path);
|
|
21541
|
+
voxevolvAssertEngineOpen(_this2);
|
|
21492
21542
|
if (!useV0Path) {
|
|
21493
21543
|
// The V1 first offer must carry the media layout so Firefox binds receive decoders for
|
|
21494
21544
|
// subscribed tracks — without it, subscribed audio/video arrive as RTP but
|
|
@@ -21503,6 +21553,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21503
21553
|
});
|
|
21504
21554
|
}
|
|
21505
21555
|
}
|
|
21556
|
+
voxevolvAssertEngineOpen(_this2);
|
|
21506
21557
|
_this2.registerOnLineListener();
|
|
21507
21558
|
_this2.clientConfiguration = joinResponse.clientConfiguration;
|
|
21508
21559
|
_this2.emit(EngineEvent.SignalConnected, joinResponse);
|
|
@@ -21545,9 +21596,12 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21545
21596
|
});
|
|
21546
21597
|
}
|
|
21547
21598
|
close() {
|
|
21599
|
+
const alreadyClosing = this.voxevolvCloseController.signal.aborted;
|
|
21600
|
+
// Discard synchronously, before cleanup waits for its lock.
|
|
21601
|
+
this.voxevolvCloseController.abort();
|
|
21548
21602
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21549
21603
|
const unlock = yield this.closingLock.lock();
|
|
21550
|
-
if (this.isClosed) {
|
|
21604
|
+
if (this.isClosed && alreadyClosing) {
|
|
21551
21605
|
unlock();
|
|
21552
21606
|
return;
|
|
21553
21607
|
}
|
|
@@ -22133,7 +22187,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22133
22187
|
attemptReconnect(reason) {
|
|
22134
22188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22135
22189
|
var _a, _b, _c;
|
|
22136
|
-
if (this._isClosed) {
|
|
22190
|
+
if (this._isClosed || this.voxevolvCloseController.signal.aborted) {
|
|
22137
22191
|
return;
|
|
22138
22192
|
}
|
|
22139
22193
|
// guard for attempting reconnection multiple times while one attempt is still not finished
|
|
@@ -22207,6 +22261,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22207
22261
|
}
|
|
22208
22262
|
yield this.cleanupPeerConnections();
|
|
22209
22263
|
yield this.cleanupClient();
|
|
22264
|
+
voxevolvAssertEngineOpen(this);
|
|
22210
22265
|
let joinResponse;
|
|
22211
22266
|
try {
|
|
22212
22267
|
if (!this.signalOpts) {
|
|
@@ -22225,9 +22280,11 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22225
22280
|
this.shouldFailNext = false;
|
|
22226
22281
|
throw new Error('simulated failure');
|
|
22227
22282
|
}
|
|
22283
|
+
voxevolvAssertEngineOpen(this);
|
|
22228
22284
|
this.client.setReconnected();
|
|
22229
22285
|
this.emit(EngineEvent.SignalRestarted, joinResponse);
|
|
22230
|
-
yield this.waitForPCReconnected();
|
|
22286
|
+
yield voxevolvUntilEngineClosed(this, undefined, () => this.waitForPCReconnected());
|
|
22287
|
+
voxevolvAssertEngineOpen(this);
|
|
22231
22288
|
// re-check signal connection state before setting engine as resumed
|
|
22232
22289
|
if (this.client.currentState !== SignalConnectionState.CONNECTED) {
|
|
22233
22290
|
throw new SignalReconnectError('Signal connection got severed during reconnect');
|
|
@@ -22236,7 +22293,9 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22236
22293
|
// reconnect success
|
|
22237
22294
|
this.emit(EngineEvent.Restarted);
|
|
22238
22295
|
} catch (error) {
|
|
22296
|
+
voxevolvAssertEngineOpen(this);
|
|
22239
22297
|
const nextRegionUrl = yield (_b = this.regionStrategy) === null || _b === void 0 ? void 0 : _b.getNextUrl();
|
|
22298
|
+
voxevolvAssertEngineOpen(this);
|
|
22240
22299
|
if (nextRegionUrl) {
|
|
22241
22300
|
yield this.restartConnection(nextRegionUrl);
|
|
22242
22301
|
return;
|
|
@@ -22264,7 +22323,8 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22264
22323
|
let res;
|
|
22265
22324
|
try {
|
|
22266
22325
|
this.setupSignalClientCallbacks();
|
|
22267
|
-
res = yield
|
|
22326
|
+
res = yield voxevolvUntilEngineClosed(this, undefined,
|
|
22327
|
+
signal => this.client.reconnect(this.url, this.token, this.participantSid, reason, signal));
|
|
22268
22328
|
} catch (error) {
|
|
22269
22329
|
let message = '';
|
|
22270
22330
|
if (error instanceof Error) {
|
|
@@ -22281,6 +22341,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22281
22341
|
}
|
|
22282
22342
|
throw new SignalReconnectError(message);
|
|
22283
22343
|
}
|
|
22344
|
+
voxevolvAssertEngineOpen(this);
|
|
22284
22345
|
this.emit(EngineEvent.SignalResumed);
|
|
22285
22346
|
if (res) {
|
|
22286
22347
|
const rtcConfig = this.makeRTCConfiguration(res);
|
|
@@ -22296,7 +22357,8 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22296
22357
|
throw new Error('simulated failure');
|
|
22297
22358
|
}
|
|
22298
22359
|
yield this.pcManager.triggerIceRestart();
|
|
22299
|
-
yield this.waitForPCReconnected();
|
|
22360
|
+
yield voxevolvUntilEngineClosed(this, undefined, () => this.waitForPCReconnected());
|
|
22361
|
+
voxevolvAssertEngineOpen(this);
|
|
22300
22362
|
// re-check signal connection state before setting engine as resumed
|
|
22301
22363
|
if (this.client.currentState !== SignalConnectionState.CONNECTED) {
|
|
22302
22364
|
throw new SignalReconnectError('Signal connection got severed during reconnect');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxevolv/client",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "Browser SDK for VoxEvolv multimodal realtime sessions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsc -p tsconfig.json && node scripts/build-browser.mjs",
|
|
44
44
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
45
|
-
"test": "npm run build && node scripts/protocol-smoke.mjs && node --test scripts/context-delivery.test.mjs scripts/context-cancellation.test.mjs scripts/diagnostic-delivery.test.mjs scripts/connection-diagnostics.test.mjs scripts/presentations.test.mjs scripts/startup-recovery.test.mjs scripts/connection-lifecycle.test.mjs scripts/audio-recovery.test.mjs scripts/recovery-progress.test.mjs scripts/reliable-sequence.test.mjs && node scripts/transcript-smoke.mjs",
|
|
45
|
+
"test": "npm run build && node scripts/protocol-smoke.mjs && node --test scripts/context-delivery.test.mjs scripts/context-cancellation.test.mjs scripts/diagnostic-delivery.test.mjs scripts/connection-diagnostics.test.mjs scripts/presentations.test.mjs scripts/startup-recovery.test.mjs scripts/reconnect-cancellation.test.mjs scripts/connection-lifecycle.test.mjs scripts/audio-recovery.test.mjs scripts/recovery-progress.test.mjs scripts/reliable-sequence.test.mjs && node scripts/transcript-smoke.mjs",
|
|
46
46
|
"pack:check": "npm run build && npm pack --dry-run"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|