@stream-io/video-client 0.0.1-alpha.87 → 0.0.1-alpha.88
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/index.browser.es.js +12 -10
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +12 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +12 -10
- package/dist/index.es.js.map +1 -1
- package/dist/src/coordinator/connection/client.d.ts +5 -5
- package/dist/src/coordinator/connection/connection.d.ts +8 -7
- package/dist/src/coordinator/connection/connection_fallback.d.ts +3 -2
- package/dist/src/coordinator/connection/types.d.ts +4 -11
- package/dist/src/coordinator/connection/utils.d.ts +4 -1
- package/dist/src/gen/coordinator/index.d.ts +75 -75
- package/package.json +1 -1
- package/src/coordinator/connection/client.ts +3 -3
- package/src/coordinator/connection/connection.ts +14 -11
- package/src/coordinator/connection/connection_fallback.ts +3 -2
- package/src/coordinator/connection/types.ts +5 -14
- package/src/coordinator/connection/utils.ts +4 -2
- package/src/gen/coordinator/index.ts +56 -56
package/dist/index.browser.es.js
CHANGED
|
@@ -3873,8 +3873,10 @@ function isFunction(value) {
|
|
|
3873
3873
|
'function' === typeof value ||
|
|
3874
3874
|
value instanceof Function));
|
|
3875
3875
|
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3876
|
+
/**
|
|
3877
|
+
* A map of known error codes.
|
|
3878
|
+
*/
|
|
3879
|
+
const KnownCodes = {
|
|
3878
3880
|
TOKEN_EXPIRED: 40,
|
|
3879
3881
|
WS_CLOSED_SUCCESS: 1000,
|
|
3880
3882
|
};
|
|
@@ -7351,7 +7353,7 @@ class StableWSConnection {
|
|
|
7351
7353
|
if (this.wsID !== wsID)
|
|
7352
7354
|
return;
|
|
7353
7355
|
this._log('onclose() - onclose callback - ' + event.code, { event, wsID });
|
|
7354
|
-
if (event.code ===
|
|
7356
|
+
if (event.code === KnownCodes.WS_CLOSED_SUCCESS) {
|
|
7355
7357
|
// this is a permanent error raised by stream..
|
|
7356
7358
|
// usually caused by invalid auth details
|
|
7357
7359
|
const error = new Error(`WS connection reject with error ${event.reason}`);
|
|
@@ -7526,7 +7528,7 @@ class StableWSConnection {
|
|
|
7526
7528
|
/**
|
|
7527
7529
|
* connect - Connect to the WS URL
|
|
7528
7530
|
* the default 15s timeout allows between 2~3 tries
|
|
7529
|
-
* @return {ConnectAPIResponse<
|
|
7531
|
+
* @return {ConnectAPIResponse<ConnectedEvent>} Promise that completes once the first health check message is received
|
|
7530
7532
|
*/
|
|
7531
7533
|
connect(timeout = 15000) {
|
|
7532
7534
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7544,7 +7546,7 @@ class StableWSConnection {
|
|
|
7544
7546
|
this.consecutiveFailures += 1;
|
|
7545
7547
|
if (
|
|
7546
7548
|
// @ts-ignore
|
|
7547
|
-
error.code ===
|
|
7549
|
+
error.code === KnownCodes.TOKEN_EXPIRED &&
|
|
7548
7550
|
!this.client.tokenManager.isStatic()) {
|
|
7549
7551
|
this._log('connect() - WS failure due to expired token, so going to try to reload token and reconnect');
|
|
7550
7552
|
this._reconnect({ refreshToken: true });
|
|
@@ -7648,7 +7650,7 @@ class StableWSConnection {
|
|
|
7648
7650
|
setTimeout(onclose, timeout != null ? timeout : 1000);
|
|
7649
7651
|
});
|
|
7650
7652
|
this._log(`disconnect() - Manually closed connection by calling client.disconnect()`);
|
|
7651
|
-
ws.close(
|
|
7653
|
+
ws.close(KnownCodes.WS_CLOSED_SUCCESS, 'Manually closed connection by calling client.disconnect()');
|
|
7652
7654
|
}
|
|
7653
7655
|
else {
|
|
7654
7656
|
this._log(`disconnect() - ws connection doesn't exist or it is already closed.`);
|
|
@@ -7660,7 +7662,7 @@ class StableWSConnection {
|
|
|
7660
7662
|
/**
|
|
7661
7663
|
* _connect - Connect to the WS endpoint
|
|
7662
7664
|
*
|
|
7663
|
-
* @return {ConnectAPIResponse<
|
|
7665
|
+
* @return {ConnectAPIResponse<ConnectedEvent>} Promise that completes once the first health check message is received
|
|
7664
7666
|
*/
|
|
7665
7667
|
_connect() {
|
|
7666
7668
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7773,7 +7775,7 @@ class StableWSConnection {
|
|
|
7773
7775
|
catch (error) {
|
|
7774
7776
|
this.isHealthy = false;
|
|
7775
7777
|
this.consecutiveFailures += 1;
|
|
7776
|
-
if (error.code ===
|
|
7778
|
+
if (error.code === KnownCodes.TOKEN_EXPIRED &&
|
|
7777
7779
|
!this.client.tokenManager.isStatic()) {
|
|
7778
7780
|
this._log('_reconnect() - WS failure due to expired token, so going to try to reload token and reconnect');
|
|
7779
7781
|
return this._reconnect({ refreshToken: true });
|
|
@@ -8465,7 +8467,7 @@ class StreamClient {
|
|
|
8465
8467
|
this.consecutiveFailures += 1;
|
|
8466
8468
|
if (e.response) {
|
|
8467
8469
|
/** connection_fallback depends on this token expiration logic */
|
|
8468
|
-
if (e.response.data.code ===
|
|
8470
|
+
if (e.response.data.code === KnownCodes.TOKEN_EXPIRED &&
|
|
8469
8471
|
!this.tokenManager.isStatic()) {
|
|
8470
8472
|
if (this.consecutiveFailures > 1) {
|
|
8471
8473
|
yield sleep(retryInterval(this.consecutiveFailures));
|
|
@@ -8781,7 +8783,7 @@ class StreamClient {
|
|
|
8781
8783
|
}
|
|
8782
8784
|
getUserAgent() {
|
|
8783
8785
|
return (this.userAgent ||
|
|
8784
|
-
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.
|
|
8786
|
+
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.87"}`);
|
|
8785
8787
|
}
|
|
8786
8788
|
setUserAgent(userAgent) {
|
|
8787
8789
|
this.userAgent = userAgent;
|