@stream-io/video-client 1.7.0 → 1.7.1

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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.7.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.0...@stream-io/video-client-1.7.1) (2024-09-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * don't attempt to recover broken WebSockets when there isn't a network connection ([#1490](https://github.com/GetStream/stream-video-js/issues/1490)) ([d576f48](https://github.com/GetStream/stream-video-js/commit/d576f48c7f819d48008359a3c30fe5d1a3372145))
11
+
5
12
  ## [1.7.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.5...@stream-io/video-client-1.7.0) (2024-09-19)
6
13
 
7
14
 
@@ -3013,7 +3013,7 @@ const retryable = async (rpc, signal) => {
3013
3013
  return result;
3014
3014
  };
3015
3015
 
3016
- const version = "1.7.0";
3016
+ const version = "1.7.1";
3017
3017
  const [major, minor, patch] = version.split('.');
3018
3018
  let sdkInfo = {
3019
3019
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -5887,7 +5887,7 @@ class StreamSfuClient {
5887
5887
  /**
5888
5888
  * Constructs a new SFU client.
5889
5889
  */
5890
- constructor({ dispatcher, credentials, sessionId, logTag, joinResponseTimeout = 5000, onSignalClose, }) {
5890
+ constructor({ dispatcher, credentials, sessionId, logTag, joinResponseTimeout = 5000, onSignalClose, streamClient, }) {
5891
5891
  /**
5892
5892
  * A buffer for ICE Candidates that are received before
5893
5893
  * the Publisher and Subscriber Peer Connections are ready to handle them.
@@ -5936,6 +5936,7 @@ class StreamSfuClient {
5936
5936
  };
5937
5937
  this.restoreWebSocket = () => {
5938
5938
  withoutConcurrency(this.restoreWebSocketConcurrencyTag, async () => {
5939
+ await this.networkAvailableTask?.promise;
5939
5940
  this.logger('debug', 'Restoring SFU WS connection');
5940
5941
  this.cleanUpWebSocket();
5941
5942
  await sleep(500);
@@ -5959,6 +5960,7 @@ class StreamSfuClient {
5959
5960
  this.dispose = () => {
5960
5961
  this.logger('debug', 'Disposing SFU client');
5961
5962
  this.unsubscribeIceTrickle();
5963
+ this.unsubscribeNetworkChanged();
5962
5964
  clearInterval(this.keepAliveInterval);
5963
5965
  clearTimeout(this.connectionCheckTimeout);
5964
5966
  clearTimeout(this.migrateAwayTimeout);
@@ -6144,6 +6146,16 @@ class StreamSfuClient {
6144
6146
  this.unsubscribeIceTrickle = dispatcher.on('iceTrickle', (iceTrickle) => {
6145
6147
  this.iceTrickleBuffer.push(iceTrickle);
6146
6148
  });
6149
+ // listen to network changes to handle offline state
6150
+ // we shouldn't attempt to recover websocket connection when offline
6151
+ this.unsubscribeNetworkChanged = streamClient.on('network.changed', (e) => {
6152
+ if (!e.online) {
6153
+ this.networkAvailableTask = promiseWithResolvers();
6154
+ }
6155
+ else {
6156
+ this.networkAvailableTask?.resolve();
6157
+ }
6158
+ });
6147
6159
  this.createWebSocket();
6148
6160
  }
6149
6161
  get isHealthy() {
@@ -9435,6 +9447,7 @@ class Call {
9435
9447
  logTag: String(this.sfuClientTag++),
9436
9448
  dispatcher: this.dispatcher,
9437
9449
  credentials: this.credentials,
9450
+ streamClient: this.streamClient,
9438
9451
  // a new session_id is necessary for the REJOIN strategy.
9439
9452
  // we use the previous session_id if available
9440
9453
  sessionId: performingRejoin ? undefined : previousSessionId,
@@ -12310,7 +12323,7 @@ class StreamClient {
12310
12323
  });
12311
12324
  };
12312
12325
  this.getUserAgent = () => {
12313
- const version = "1.7.0";
12326
+ const version = "1.7.1";
12314
12327
  return (this.userAgent ||
12315
12328
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12316
12329
  };