@stream-io/video-client 1.44.2 → 1.44.3
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 +6 -0
- package/dist/index.browser.es.js +9 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +9 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +9 -4
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamSfuClient.d.ts +1 -0
- package/package.json +1 -1
- package/src/StreamSfuClient.ts +15 -9
- package/src/rpc/retryable.ts +2 -0
|
@@ -103,6 +103,7 @@ export declare class StreamSfuClient {
|
|
|
103
103
|
private readonly credentials;
|
|
104
104
|
private readonly dispatcher;
|
|
105
105
|
private readonly joinResponseTimeout;
|
|
106
|
+
private readonly subscriptionsConcurrencyTag;
|
|
106
107
|
private networkAvailableTask;
|
|
107
108
|
/**
|
|
108
109
|
* Promise that resolves when the JoinResponse is received.
|
package/package.json
CHANGED
package/src/StreamSfuClient.ts
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
promiseWithResolvers,
|
|
38
38
|
SafePromise,
|
|
39
39
|
} from './helpers/promise';
|
|
40
|
+
import { withoutConcurrency } from './helpers/concurrency';
|
|
40
41
|
import { getTimers } from './timers';
|
|
41
42
|
import { Tracer, TraceSlice } from './stats';
|
|
42
43
|
import { SfuJoinError } from './errors';
|
|
@@ -164,6 +165,9 @@ export class StreamSfuClient {
|
|
|
164
165
|
private readonly credentials: Credentials;
|
|
165
166
|
private readonly dispatcher: Dispatcher;
|
|
166
167
|
private readonly joinResponseTimeout: number;
|
|
168
|
+
private readonly subscriptionsConcurrencyTag = Symbol(
|
|
169
|
+
'subscriptionsConcurrencyTag',
|
|
170
|
+
);
|
|
167
171
|
private networkAvailableTask: PromiseWithResolvers<void> | undefined;
|
|
168
172
|
/**
|
|
169
173
|
* Promise that resolves when the JoinResponse is received.
|
|
@@ -391,15 +395,17 @@ export class StreamSfuClient {
|
|
|
391
395
|
};
|
|
392
396
|
|
|
393
397
|
updateSubscriptions = async (tracks: TrackSubscriptionDetails[]) => {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
398
|
+
return withoutConcurrency(this.subscriptionsConcurrencyTag, async () => {
|
|
399
|
+
await this.joinTask;
|
|
400
|
+
return retryable(
|
|
401
|
+
(invocationMeta) =>
|
|
402
|
+
this.rpc.updateSubscriptions(
|
|
403
|
+
{ sessionId: this.sessionId, tracks },
|
|
404
|
+
{ invocationMeta },
|
|
405
|
+
),
|
|
406
|
+
this.abortController.signal,
|
|
407
|
+
);
|
|
408
|
+
});
|
|
403
409
|
};
|
|
404
410
|
|
|
405
411
|
setPublisher = async (data: Omit<SetPublisherRequest, 'sessionId'>) => {
|
package/src/rpc/retryable.ts
CHANGED
|
@@ -44,6 +44,8 @@ export const retryable = async <
|
|
|
44
44
|
let result: FinishedUnaryCall<I, O> | undefined = undefined;
|
|
45
45
|
do {
|
|
46
46
|
if (attempt > 0) await sleep(retryInterval(attempt));
|
|
47
|
+
if (signal?.aborted) throw new Error(signal.reason);
|
|
48
|
+
|
|
47
49
|
try {
|
|
48
50
|
result = await rpc({ attempt });
|
|
49
51
|
} catch (err) {
|