livekit-client 2.6.0 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11176,7 +11176,7 @@ function getOSVersion(ua) {
11176
11176
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11177
11177
  }
11178
11178
 
11179
- var version$1 = "2.6.0";
11179
+ var version$1 = "2.6.1";
11180
11180
 
11181
11181
  const version = version$1;
11182
11182
  const protocolVersion = 15;
@@ -13380,11 +13380,11 @@ class SignalClient {
13380
13380
  const abortHandler = () => __awaiter(this, void 0, void 0, function* () {
13381
13381
  this.close();
13382
13382
  clearTimeout(wsTimeout);
13383
- reject(new ConnectionError('room connection has been cancelled (signal)'));
13383
+ reject(new ConnectionError('room connection has been cancelled (signal)', ConnectionErrorReason.Cancelled));
13384
13384
  });
13385
13385
  const wsTimeout = setTimeout(() => {
13386
13386
  this.close();
13387
- reject(new ConnectionError('room connection has timed out (signal)'));
13387
+ reject(new ConnectionError('room connection has timed out (signal)', ConnectionErrorReason.ServerUnreachable));
13388
13388
  }, opts.websocketTimeout);
13389
13389
  if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
13390
13390
  abortHandler();
@@ -13466,7 +13466,7 @@ class SignalClient {
13466
13466
  reject(new ConnectionError('Received leave request while trying to (re)connect', ConnectionErrorReason.LeaveRequest));
13467
13467
  } else if (!opts.reconnect) {
13468
13468
  // non-reconnect case, should receive join response first
13469
- reject(new ConnectionError("did not receive join response, got ".concat((_c = resp.message) === null || _c === void 0 ? void 0 : _c.case, " instead")));
13469
+ reject(new ConnectionError("did not receive join response, got ".concat((_c = resp.message) === null || _c === void 0 ? void 0 : _c.case, " instead"), ConnectionErrorReason.InternalError));
13470
13470
  }
13471
13471
  if (!shouldProcessMessage) {
13472
13472
  return;
@@ -13479,7 +13479,7 @@ class SignalClient {
13479
13479
  });
13480
13480
  this.ws.onclose = ev => {
13481
13481
  if (this.isEstablishingConnection) {
13482
- reject(new ConnectionError('Websocket got closed during a (re)connection attempt'));
13482
+ reject(new ConnectionError('Websocket got closed during a (re)connection attempt', ConnectionErrorReason.InternalError));
13483
13483
  }
13484
13484
  this.log.warn("websocket closed", Object.assign(Object.assign({}, this.logContext), {
13485
13485
  reason: ev.reason,
@@ -15478,7 +15478,7 @@ class PCTransportManager {
15478
15478
  abortController === null || abortController === void 0 ? void 0 : abortController.signal.addEventListener('abort', abortHandler);
15479
15479
  const connectTimeout = CriticalTimers.setTimeout(() => {
15480
15480
  abortController === null || abortController === void 0 ? void 0 : abortController.signal.removeEventListener('abort', abortHandler);
15481
- reject(new ConnectionError('could not establish pc connection'));
15481
+ reject(new ConnectionError('could not establish pc connection', ConnectionErrorReason.InternalError));
15482
15482
  }, timeout);
15483
15483
  while (this.state !== PCTransportState.CONNECTED) {
15484
15484
  yield sleep(50); // FIXME we shouldn't rely on `sleep` in the connection paths, as it invokes `setTimeout` which can be drastically throttled by browser implementations
@@ -17009,7 +17009,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17009
17009
  return new Promise((resolve, reject) => {
17010
17010
  const publicationTimeout = setTimeout(() => {
17011
17011
  delete this.pendingTrackResolvers[req.cid];
17012
- reject(new ConnectionError('publication of local track timed out, no response from server'));
17012
+ reject(new ConnectionError('publication of local track timed out, no response from server', ConnectionErrorReason.InternalError));
17013
17013
  }, 10000);
17014
17014
  this.pendingTrackResolvers[req.cid] = {
17015
17015
  resolve: info => {
@@ -17556,7 +17556,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17556
17556
  } catch (e) {
17557
17557
  // TODO do we need a `failed` state here for the PC?
17558
17558
  this.pcState = PCState.Disconnected;
17559
- throw new ConnectionError("could not establish PC connection, ".concat(e.message));
17559
+ throw new ConnectionError("could not establish PC connection, ".concat(e.message), ConnectionErrorReason.InternalError);
17560
17560
  }
17561
17561
  });
17562
17562
  }
@@ -17588,7 +17588,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17588
17588
  const transport = subscriber ? _this2.pcManager.subscriber : _this2.pcManager.publisher;
17589
17589
  const transportName = subscriber ? 'Subscriber' : 'Publisher';
17590
17590
  if (!transport) {
17591
- throw new ConnectionError("".concat(transportName, " connection not set"));
17591
+ throw new ConnectionError("".concat(transportName, " connection not set"), ConnectionErrorReason.InternalError);
17592
17592
  }
17593
17593
  let needNegotiation = false;
17594
17594
  if (!subscriber && !_this2.dataChannelForKind(kind, subscriber)) {
@@ -17614,7 +17614,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17614
17614
  }
17615
17615
  yield sleep(50);
17616
17616
  }
17617
- throw new ConnectionError("could not establish ".concat(transportName, " connection, state: ").concat(transport.getICEConnectionState()));
17617
+ throw new ConnectionError("could not establish ".concat(transportName, " connection, state: ").concat(transport.getICEConnectionState()), ConnectionErrorReason.InternalError);
17618
17618
  }();
17619
17619
  });
17620
17620
  }
@@ -17860,7 +17860,7 @@ class RegionUrlProvider {
17860
17860
  this.lastUpdateAt = Date.now();
17861
17861
  return regionSettings;
17862
17862
  } else {
17863
- throw new ConnectionError("Could not fetch region settings: ".concat(regionSettingsResponse.statusText), regionSettingsResponse.status === 401 ? ConnectionErrorReason.NotAllowed : undefined, regionSettingsResponse.status);
17863
+ throw new ConnectionError("Could not fetch region settings: ".concat(regionSettingsResponse.statusText), regionSettingsResponse.status === 401 ? ConnectionErrorReason.NotAllowed : ConnectionErrorReason.InternalError, regionSettingsResponse.status);
17864
17864
  }
17865
17865
  });
17866
17866
  }
@@ -21502,7 +21502,7 @@ class Room extends eventsExports.EventEmitter {
21502
21502
  } catch (err) {
21503
21503
  yield this.engine.close();
21504
21504
  this.recreateEngine();
21505
- const resultingError = new ConnectionError("could not establish signal connection");
21505
+ const resultingError = new ConnectionError("could not establish signal connection", ConnectionErrorReason.ServerUnreachable);
21506
21506
  if (err instanceof Error) {
21507
21507
  resultingError.message = "".concat(resultingError.message, ": ").concat(err.message);
21508
21508
  }
@@ -21518,7 +21518,7 @@ class Room extends eventsExports.EventEmitter {
21518
21518
  if (abortController.signal.aborted) {
21519
21519
  yield this.engine.close();
21520
21520
  this.recreateEngine();
21521
- throw new ConnectionError("Connection attempt aborted");
21521
+ throw new ConnectionError("Connection attempt aborted", ConnectionErrorReason.Cancelled);
21522
21522
  }
21523
21523
  try {
21524
21524
  yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout, abortController);
@@ -21565,7 +21565,7 @@ class Room extends eventsExports.EventEmitter {
21565
21565
  _this2.log.warn('abort connection attempt', _this2.logContext);
21566
21566
  (_a = _this2.abortController) === null || _a === void 0 ? void 0 : _a.abort();
21567
21567
  // in case the abort controller didn't manage to cancel the connection attempt, reject the connect promise explicitly
21568
- (_c = (_b = _this2.connectFuture) === null || _b === void 0 ? void 0 : _b.reject) === null || _c === void 0 ? void 0 : _c.call(_b, new ConnectionError('Client initiated disconnect'));
21568
+ (_c = (_b = _this2.connectFuture) === null || _b === void 0 ? void 0 : _b.reject) === null || _c === void 0 ? void 0 : _c.call(_b, new ConnectionError('Client initiated disconnect', ConnectionErrorReason.Cancelled));
21569
21569
  _this2.connectFuture = undefined;
21570
21570
  }
21571
21571
  // send leave