@signalwire/js 4.0.0-dev-20260318131609 → 4.0.0-dev-20260318132643

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/dist/browser.mjs CHANGED
@@ -3107,7 +3107,7 @@ var require_throwError = /* @__PURE__ */ __commonJSMin(((exports) => {
3107
3107
  exports.throwError = void 0;
3108
3108
  var Observable_1$18 = require_Observable();
3109
3109
  var isFunction_1$14 = require_isFunction();
3110
- function throwError(errorOrErrorFactory, scheduler) {
3110
+ function throwError$1(errorOrErrorFactory, scheduler) {
3111
3111
  var errorFactory = isFunction_1$14.isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
3112
3112
  return errorOrErrorFactory;
3113
3113
  };
@@ -3118,7 +3118,7 @@ var require_throwError = /* @__PURE__ */ __commonJSMin(((exports) => {
3118
3118
  return scheduler.schedule(init, 0, subscriber);
3119
3119
  } : init);
3120
3120
  }
3121
- exports.throwError = throwError;
3121
+ exports.throwError = throwError$1;
3122
3122
  }));
3123
3123
 
3124
3124
  //#endregion
@@ -4327,13 +4327,13 @@ var require_race$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
4327
4327
  var innerFrom_1$28 = require_innerFrom();
4328
4328
  var argsOrArgArray_1$4 = require_argsOrArgArray();
4329
4329
  var OperatorSubscriber_1$48 = require_OperatorSubscriber();
4330
- function race$3() {
4330
+ function race$4() {
4331
4331
  var sources = [];
4332
4332
  for (var _i = 0; _i < arguments.length; _i++) sources[_i] = arguments[_i];
4333
4333
  sources = argsOrArgArray_1$4.argsOrArgArray(sources);
4334
4334
  return sources.length === 1 ? innerFrom_1$28.innerFrom(sources[0]) : new Observable_1$6.Observable(raceInit(sources));
4335
4335
  }
4336
- exports.race = race$3;
4336
+ exports.race = race$4;
4337
4337
  function raceInit(sources) {
4338
4338
  return function(subscriber) {
4339
4339
  var subscriptions = [];
@@ -5470,7 +5470,7 @@ var require_distinctUntilChanged = /* @__PURE__ */ __commonJSMin(((exports) => {
5470
5470
  var identity_1$10 = require_identity();
5471
5471
  var lift_1$42 = require_lift();
5472
5472
  var OperatorSubscriber_1$31 = require_OperatorSubscriber();
5473
- function distinctUntilChanged$5(comparator, keySelector) {
5473
+ function distinctUntilChanged$6(comparator, keySelector) {
5474
5474
  if (keySelector === void 0) keySelector = identity_1$10.identity;
5475
5475
  comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
5476
5476
  return lift_1$42.operate(function(source, subscriber) {
@@ -5486,7 +5486,7 @@ var require_distinctUntilChanged = /* @__PURE__ */ __commonJSMin(((exports) => {
5486
5486
  }));
5487
5487
  });
5488
5488
  }
5489
- exports.distinctUntilChanged = distinctUntilChanged$5;
5489
+ exports.distinctUntilChanged = distinctUntilChanged$6;
5490
5490
  function defaultCompare(a, b) {
5491
5491
  return a === b;
5492
5492
  }
@@ -6934,7 +6934,7 @@ var require_switchMap = /* @__PURE__ */ __commonJSMin(((exports) => {
6934
6934
  var innerFrom_1$6 = require_innerFrom();
6935
6935
  var lift_1$13 = require_lift();
6936
6936
  var OperatorSubscriber_1$11 = require_OperatorSubscriber();
6937
- function switchMap$3(project, resultSelector) {
6937
+ function switchMap$4(project, resultSelector) {
6938
6938
  return lift_1$13.operate(function(source, subscriber) {
6939
6939
  var innerSubscriber = null;
6940
6940
  var index = 0;
@@ -6958,7 +6958,7 @@ var require_switchMap = /* @__PURE__ */ __commonJSMin(((exports) => {
6958
6958
  }));
6959
6959
  });
6960
6960
  }
6961
- exports.switchMap = switchMap$3;
6961
+ exports.switchMap = switchMap$4;
6962
6962
  }));
6963
6963
 
6964
6964
  //#endregion
@@ -9104,13 +9104,14 @@ var DependencyError = class extends Error {
9104
9104
  }
9105
9105
  };
9106
9106
  var CallCreateError = class extends Error {
9107
- constructor(message, error = null, options) {
9107
+ constructor(message, error = null, direction = "outbound", options) {
9108
9108
  super(message, {
9109
9109
  ...options,
9110
9110
  cause: options?.cause ?? (error instanceof Error ? error : void 0)
9111
9111
  });
9112
9112
  this.message = message;
9113
9113
  this.error = error;
9114
+ this.direction = direction;
9114
9115
  this.name = "CallCreateError";
9115
9116
  }
9116
9117
  };
@@ -9982,7 +9983,7 @@ var NavigatorDeviceController = class extends Destroyable {
9982
9983
  };
9983
9984
  this._devicesState$ = this.createBehaviorSubject(initialDevicesState);
9984
9985
  this._selectedDevicesState$ = this.createBehaviorSubject(initialSelectedDevicesState);
9985
- this._errors$ = this.createSubject();
9986
+ this._errors$ = this.createReplaySubject(1);
9986
9987
  this.init();
9987
9988
  }
9988
9989
  get selectedAudioInputDeviceConstraints() {
@@ -10724,12 +10725,12 @@ var require_race = /* @__PURE__ */ __commonJSMin(((exports) => {
10724
10725
  exports.race = void 0;
10725
10726
  var argsOrArgArray_1 = require_argsOrArgArray();
10726
10727
  var raceWith_1$1 = require_raceWith();
10727
- function race$2() {
10728
+ function race$3() {
10728
10729
  var args = [];
10729
10730
  for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
10730
10731
  return raceWith_1$1.raceWith.apply(void 0, __spreadArray([], __read(argsOrArgArray_1.argsOrArgArray(args))));
10731
10732
  }
10732
- exports.race = race$2;
10733
+ exports.race = race$3;
10733
10734
  }));
10734
10735
 
10735
10736
  //#endregion
@@ -12428,7 +12429,6 @@ var CallEventsManager = class extends Destroyable {
12428
12429
  this.options = options;
12429
12430
  this.callIds = /* @__PURE__ */ new Set();
12430
12431
  this.roomSessionIds = /* @__PURE__ */ new Set();
12431
- this._status$ = this.createBehaviorSubject("trying");
12432
12432
  this._participants$ = this.createBehaviorSubject({});
12433
12433
  this._self$ = this.createBehaviorSubject(null);
12434
12434
  this._sessionState$ = this.createBehaviorSubject(initialSessionState);
@@ -12443,12 +12443,6 @@ var CallEventsManager = class extends Destroyable {
12443
12443
  get self$() {
12444
12444
  return this.cachedObservable("self$", () => this._self$.asObservable().pipe(filterNull()));
12445
12445
  }
12446
- get status$() {
12447
- return this._status$.asObservable();
12448
- }
12449
- get status() {
12450
- return this._status$.value;
12451
- }
12452
12446
  isRoomSessionIdValid(roomSessionId) {
12453
12447
  return this.roomSessionIds.has(roomSessionId);
12454
12448
  }
@@ -12533,7 +12527,6 @@ var CallEventsManager = class extends Destroyable {
12533
12527
  callId: callJoinedEvent.call_id,
12534
12528
  roomSessionId: callJoinedEvent.room_session_id
12535
12529
  });
12536
- this._status$.next("connected");
12537
12530
  const sessionState = callJoinedEvent.room_session;
12538
12531
  const { capabilities } = callJoinedEvent;
12539
12532
  this.selfId = this.selfId ?? callJoinedEvent.member_id;
@@ -13356,7 +13349,7 @@ var RTCPeerConnectionController = class extends Destroyable {
13356
13349
  this._connectionState$ = this.createReplaySubject(1);
13357
13350
  this._signalingState$ = this.createReplaySubject(1);
13358
13351
  this._iceGatheringState$ = this.createReplaySubject(1);
13359
- this._errors$ = this.createSubject();
13352
+ this._errors$ = this.createReplaySubject(1);
13360
13353
  this._iceCandidates$ = this.createReplaySubject(1);
13361
13354
  this._initialized$ = this.createReplaySubject(1);
13362
13355
  this._remoteDescription$ = this.createReplaySubject(1);
@@ -13797,37 +13790,29 @@ var RTCPeerConnectionController = class extends Destroyable {
13797
13790
  }
13798
13791
  async setupLocalTracks() {
13799
13792
  logger$11.debug("[RTCPeerConnectionController] Setting up local tracks/transceivers.");
13800
- let { localStream } = this;
13801
- if (!localStream) try {
13802
- localStream = await this.localStreamController.buildLocalStream();
13803
- } catch (error) {
13804
- logger$11.error("[RTCPeerConnectionController] Error building local stream:", error);
13805
- this._errors$.next(error);
13806
- }
13807
- if (localStream) {
13808
- if (this.transceiverController?.useAddStream ?? false) {
13809
- logger$11.warn("[RTCPeerConnectionController] Using deprecated addStream API to add local stream.");
13810
- this.peerConnection?.addStream(localStream);
13811
- if (!this.isNegotiating) {
13812
- logger$11.debug("[RTCPeerConnectionController] Forcing negotiationneeded after local tracks setup.");
13813
- this.negotiationNeeded$.next();
13814
- }
13815
- return;
13793
+ const localStream = this.localStream ?? await this.localStreamController.buildLocalStream();
13794
+ if (this.transceiverController?.useAddStream ?? false) {
13795
+ logger$11.warn("[RTCPeerConnectionController] Using deprecated addStream API to add local stream.");
13796
+ this.peerConnection?.addStream(localStream);
13797
+ if (!this.isNegotiating) {
13798
+ logger$11.debug("[RTCPeerConnectionController] Forcing negotiationneeded after local tracks setup.");
13799
+ this.negotiationNeeded$.next();
13816
13800
  }
13817
- for (const kind of ["audio", "video"]) {
13818
- const tracks = (kind === "audio" ? localStream.getAudioTracks() : localStream.getVideoTracks()).map((track, index) => ({
13819
- index,
13820
- track
13821
- }));
13822
- for (const { index, track } of tracks) {
13823
- this.localStreamController.addTrackEndedListener(track);
13824
- if (this.transceiverController?.useAddTransceivers ?? false) {
13825
- const transceivers = (kind === "audio" ? this.transceiverController?.audioTransceivers : this.transceiverController?.videoTransceivers) ?? [];
13826
- await this.transceiverController?.setupTransceiverSender(track, localStream, transceivers[index]);
13827
- } else {
13828
- logger$11.debug(`[RTCPeerConnectionController] Using addTrack for local ${kind} track:`, track.id);
13829
- this.peerConnection?.addTrack(track, localStream);
13830
- }
13801
+ return;
13802
+ }
13803
+ for (const kind of ["audio", "video"]) {
13804
+ const tracks = (kind === "audio" ? localStream.getAudioTracks() : localStream.getVideoTracks()).map((track, index) => ({
13805
+ index,
13806
+ track
13807
+ }));
13808
+ for (const { index, track } of tracks) {
13809
+ this.localStreamController.addTrackEndedListener(track);
13810
+ if (this.transceiverController?.useAddTransceivers ?? false) {
13811
+ const transceivers = (kind === "audio" ? this.transceiverController?.audioTransceivers : this.transceiverController?.videoTransceivers) ?? [];
13812
+ await this.transceiverController?.setupTransceiverSender(track, localStream, transceivers[index]);
13813
+ } else {
13814
+ logger$11.debug(`[RTCPeerConnectionController] Using addTrack for local ${kind} track:`, track.id);
13815
+ this.peerConnection?.addTrack(track, localStream);
13831
13816
  }
13832
13817
  }
13833
13818
  }
@@ -14103,6 +14088,7 @@ var WebRTCVertoManager = class extends VertoManager {
14103
14088
  });
14104
14089
  this.subscribeTo(this.vertoAnswer$, (event) => {
14105
14090
  logger$10.debug("[WebRTCManager] Received Verto answer event:", event);
14091
+ this._signalingStatus$.next("connecting");
14106
14092
  const { sdp, callID } = event;
14107
14093
  this._rtcPeerConnectionsMap.get(callID)?.updateAnswerStatus({
14108
14094
  status: "received",
@@ -14174,13 +14160,13 @@ var WebRTCVertoManager = class extends VertoManager {
14174
14160
  if (response.error) {
14175
14161
  const error = new JSONRPCError(response.error.code, response.error.message, response.error.data);
14176
14162
  this.onError?.(error);
14177
- throw error;
14163
+ return response;
14178
14164
  }
14179
14165
  const innerResult = getValueFrom(response, "result.result");
14180
14166
  if (innerResult?.error) {
14181
14167
  const error = new JSONRPCError(innerResult.error.code, innerResult.error.message, innerResult.error.data);
14182
14168
  this.onError?.(error);
14183
- throw error;
14169
+ return response;
14184
14170
  }
14185
14171
  return response;
14186
14172
  }
@@ -14200,7 +14186,7 @@ var WebRTCVertoManager = class extends VertoManager {
14200
14186
  }
14201
14187
  } catch (error) {
14202
14188
  logger$10.error(`[WebRTCManager] Error sending Verto ${vertoMethod}:`, error);
14203
- throw error;
14189
+ this.onError?.(error instanceof Error ? error : new Error(String(error), { cause: error }));
14204
14190
  }
14205
14191
  }
14206
14192
  async processModifyResponse(response, rtcPeerConnController) {
@@ -14214,12 +14200,14 @@ var WebRTCVertoManager = class extends VertoManager {
14214
14200
  });
14215
14201
  } catch (error) {
14216
14202
  logger$10.warn("[WebRTCManager] Error processing modify response:", error);
14217
- this.onError?.(error instanceof Error ? error : new Error(String(error), { cause: error }));
14203
+ const modifyError = error instanceof Error ? error : new Error(String(error), { cause: error });
14204
+ this.onError?.(modifyError);
14218
14205
  }
14219
14206
  }
14220
14207
  }
14221
14208
  processInviteResponse(response, rtcPeerConnController) {
14222
14209
  if (!response.error && getValueFrom(response, "result.result.result.message") === "CALL CREATED") {
14210
+ this._signalingStatus$.next("trying");
14223
14211
  this._nodeId$.next(getValueFrom(response, "result.node_id") ?? null);
14224
14212
  const memberId = getValueFrom(response, "result.result.result.memberID") ?? null;
14225
14213
  const callId = getValueFrom(response, "result.result.result.callID") ?? null;
@@ -14337,7 +14325,6 @@ var WebRTCVertoManager = class extends VertoManager {
14337
14325
  });
14338
14326
  this.sendLocalDescriptionOnceAccepted(vertoMessageRequest, rtcPeerConnController);
14339
14327
  } else if (initial) {
14340
- this._signalingStatus$.next("trying");
14341
14328
  const vertoMessageRequest = VertoInvite({
14342
14329
  dialogParams,
14343
14330
  sdp
@@ -14644,7 +14631,8 @@ var WebRTCCall = class extends Destroyable {
14644
14631
  this.clientSession = clientSession;
14645
14632
  this.options = options;
14646
14633
  this.address = address;
14647
- this._errors$ = this.createSubject();
14634
+ this._errors$ = this.createReplaySubject(1);
14635
+ this._lastMergedStatus = "new";
14648
14636
  this._answered$ = this.createReplaySubject();
14649
14637
  this._holdState = false;
14650
14638
  this._userVariables$ = this.createBehaviorSubject({ ...PreferencesContainer.instance.userVariables });
@@ -14665,8 +14653,10 @@ var WebRTCCall = class extends Destroyable {
14665
14653
  const managers = initialization.initializeManagers(this);
14666
14654
  this.vertoManager = managers.vertoManager;
14667
14655
  this.callEventsManager = managers.callEventsManager;
14668
- if (options.initOffer) this._status$ = this.createBehaviorSubject("ringing");
14669
- else this._status$ = this.createBehaviorSubject("new");
14656
+ if (options.initOffer) {
14657
+ this._status$ = this.createBehaviorSubject("ringing");
14658
+ this._lastMergedStatus = "ringing";
14659
+ } else this._status$ = this.createBehaviorSubject("new");
14670
14660
  const { deviceController } = initialization;
14671
14661
  this.participantFactory = new ParticipantFactory(this.executeMethod.bind(this), this.vertoManager, deviceController);
14672
14662
  }
@@ -14674,9 +14664,17 @@ var WebRTCCall = class extends Destroyable {
14674
14664
  get errors$() {
14675
14665
  return this._errors$.asObservable();
14676
14666
  }
14677
- /** @internal Push an error to the call's error stream. */
14678
- emitError(error) {
14679
- this._errors$.next(error);
14667
+ /**
14668
+ * @internal Push an error to the call's error stream.
14669
+ * Fatal errors automatically transition the call to `'failed'` and destroy it.
14670
+ */
14671
+ emitError(callError) {
14672
+ if (this._status$.value === "destroyed" || this._status$.value === "failed") return;
14673
+ this._errors$.next(callError);
14674
+ if (callError.fatal) {
14675
+ this._status$.next("failed");
14676
+ this.destroy();
14677
+ }
14680
14678
  }
14681
14679
  /** Whether this call is `'inbound'` or `'outbound'`. */
14682
14680
  get direction() {
@@ -14788,7 +14786,9 @@ var WebRTCCall = class extends Destroyable {
14788
14786
  }
14789
14787
  /** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
14790
14788
  get status$() {
14791
- return this.cachedObservable("status$", () => (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$));
14789
+ return this.cachedObservable("status$", () => (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$).pipe((0, import_cjs$9.distinctUntilChanged)(), (0, import_cjs$9.tap)((status) => {
14790
+ this._lastMergedStatus = status;
14791
+ })));
14792
14792
  }
14793
14793
  /** Observable of the participants list, emits on join/leave/update. */
14794
14794
  get participants$() {
@@ -14828,7 +14828,7 @@ var WebRTCCall = class extends Destroyable {
14828
14828
  }
14829
14829
  /** Current call status. */
14830
14830
  get status() {
14831
- return this._status$.value;
14831
+ return this._lastMergedStatus;
14832
14832
  }
14833
14833
  /** Whether the call is currently being recorded. */
14834
14834
  get recording() {
@@ -15041,6 +15041,7 @@ var WebRTCCall = class extends Destroyable {
15041
15041
  }
15042
15042
  /** Destroys the call, releasing all resources and subscriptions. */
15043
15043
  destroy() {
15044
+ if (this._status$.value === "destroyed") return;
15044
15045
  this._status$.next("destroyed");
15045
15046
  this.vertoManager.destroy();
15046
15047
  this.callEventsManager.destroy();
@@ -15051,6 +15052,23 @@ var WebRTCCall = class extends Destroyable {
15051
15052
  //#endregion
15052
15053
  //#region src/managers/CallFactory.ts
15053
15054
  /**
15055
+ * Infers the semantic error category from a raw Error thrown by VertoManager
15056
+ * or an RTCPeerConnection layer.
15057
+ */
15058
+ function inferCallErrorKind(error) {
15059
+ if (error instanceof RPCTimeoutError) return "timeout";
15060
+ if (error instanceof JSONRPCError) return "signaling";
15061
+ if (error instanceof MediaTrackError) return "media";
15062
+ if (error instanceof WebSocketConnectionError || error instanceof TransportConnectionError) return "network";
15063
+ return "internal";
15064
+ }
15065
+ /** Determines whether an error should be fatal (destroy the call). */
15066
+ function isFatalError(error) {
15067
+ if (error instanceof VertoPongError) return false;
15068
+ if (error instanceof MediaTrackError) return false;
15069
+ return true;
15070
+ }
15071
+ /**
15054
15072
  * Factory for creating WebRTCCall instances with proper manager wiring.
15055
15073
  * Eliminates circular dependencies by centralizing Call and Manager creation.
15056
15074
  */
@@ -15071,7 +15089,13 @@ var CallFactory = class {
15071
15089
  vertoManager: new WebRTCVertoManager(callInstance, this.attachManager, this.deviceController, this.webRTCApiProvider, {
15072
15090
  nodeId: options.nodeId,
15073
15091
  onError: (error) => {
15074
- callInstance.emitError(error);
15092
+ const callError = {
15093
+ kind: inferCallErrorKind(error),
15094
+ fatal: isFatalError(error),
15095
+ error,
15096
+ callId: callInstance.id
15097
+ };
15098
+ callInstance.emitError(callError);
15075
15099
  }
15076
15100
  }),
15077
15101
  callEventsManager: new CallEventsManager(callInstance)
@@ -15516,7 +15540,7 @@ var ClientSessionManager = class extends Destroyable {
15516
15540
  revision: 0
15517
15541
  };
15518
15542
  this._authorization$ = this.createBehaviorSubject(void 0);
15519
- this._errors$ = this.createSubject();
15543
+ this._errors$ = this.createReplaySubject(1);
15520
15544
  this._authenticated$ = this.createBehaviorSubject(false);
15521
15545
  this._subscriberInfo$ = this.createBehaviorSubject(null);
15522
15546
  this._calls$ = this.createBehaviorSubject({});
@@ -15786,12 +15810,13 @@ var ClientSessionManager = class extends Destroyable {
15786
15810
  }
15787
15811
  async createOutboundCall(destination, options = {}) {
15788
15812
  const destinationURI = destination instanceof Address ? destination.defaultChannel : destination;
15813
+ let callSession;
15789
15814
  try {
15790
- const callSession = await this.createCall({
15815
+ callSession = await this.createCall({
15791
15816
  to: destinationURI,
15792
15817
  ...options
15793
15818
  });
15794
- await (0, import_cjs$5.firstValueFrom)(callSession.selfId$.pipe((0, import_cjs$5.filter)((id) => Boolean(id)), (0, import_cjs$5.take)(1), (0, import_cjs$5.timeout)(this.callCreateTimeout)));
15819
+ await (0, import_cjs$5.firstValueFrom)((0, import_cjs$5.race)(callSession.selfId$.pipe((0, import_cjs$5.filter)((id) => Boolean(id)), (0, import_cjs$5.take)(1), (0, import_cjs$5.timeout)(this.callCreateTimeout)), callSession.errors$.pipe((0, import_cjs$5.take)(1), (0, import_cjs$5.switchMap)((callError) => (0, import_cjs$5.throwError)(() => callError.error)))));
15795
15820
  this._calls$.next({
15796
15821
  [`${callSession.id}`]: callSession,
15797
15822
  ...this._calls$.value
@@ -15799,7 +15824,8 @@ var ClientSessionManager = class extends Destroyable {
15799
15824
  return callSession;
15800
15825
  } catch (error) {
15801
15826
  logger$6.error("[Session] Error creating outbound call:", error);
15802
- const callError = new CallCreateError("Call create timeout", error);
15827
+ callSession?.destroy();
15828
+ const callError = new CallCreateError(error instanceof import_cjs$5.TimeoutError ? "Call create timeout" : "Call creation failed", error, "outbound");
15803
15829
  this._errors$.next(callError);
15804
15830
  throw callError;
15805
15831
  }
@@ -15825,7 +15851,7 @@ var ClientSessionManager = class extends Destroyable {
15825
15851
  return callSession;
15826
15852
  } catch (error) {
15827
15853
  logger$6.error("[Session] Error creating call session:", error);
15828
- throw new CallCreateError("Call create error", error);
15854
+ throw new CallCreateError("Call create error", error, options.initOffer ? "inbound" : "outbound");
15829
15855
  }
15830
15856
  }
15831
15857
  destroy() {
@@ -16074,7 +16100,7 @@ var WebSocketController = class WebSocketController extends Destroyable {
16074
16100
  this.shouldReconnect = false;
16075
16101
  this._status$ = this.createBehaviorSubject("disconnected");
16076
16102
  this._incomingMessages$ = this.createSubject();
16077
- this._errors$ = this.createSubject();
16103
+ this._errors$ = this.createReplaySubject(1);
16078
16104
  this.reconnectDelayMin = options.reconnectDelayMin ?? WebSocketController.DEFAULT_RECONNECT_DELAY_MIN_MS;
16079
16105
  this.reconnectDelayMax = options.reconnectDelayMax ?? WebSocketController.DEFAULT_RECONNECT_DELAY_MAX_MS;
16080
16106
  this.connectionTimeout = options.connectionTimeout ?? WebSocketController.DEFAULT_CONNECTION_TIMEOUT_MS;
@@ -16432,7 +16458,7 @@ var SignalWire = class extends Destroyable {
16432
16458
  this._directory$ = this.createBehaviorSubject(void 0);
16433
16459
  this._isConnected$ = this.createBehaviorSubject(false);
16434
16460
  this._isRegistered$ = this.createBehaviorSubject(false);
16435
- this._errors$ = this.createSubject();
16461
+ this._errors$ = this.createReplaySubject(1);
16436
16462
  this._options = {};
16437
16463
  this._deps = new DependencyContainer();
16438
16464
  this._options = {