Skip to content

Commit

Permalink
Move setPublisher and sendAnswer retryable wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Jul 22, 2023
1 parent d47c3c0 commit e57a81a
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions packages/client/src/StreamSfuClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,33 +201,21 @@ export class StreamSfuClient {
};

updateSubscriptions = async (subscriptions: TrackSubscriptionDetails[]) => {
// TODO: retry handler lifted to Call so the state is reachable (?)
return this.rpc.updateSubscriptions({
sessionId: this.sessionId,
tracks: subscriptions,
});
};

setPublisher = async (data: Omit<SetPublisherRequest, 'sessionId'>) => {
// FIXME: needs to compare values to abort
return runWithRetry(
handleFalsePositiveResponse(this.rpc.setPublisher.bind(this.rpc)),
{
isRetryable: isRetryablePreset,
},
)({
return this.rpc.setPublisher({
...data,
sessionId: this.sessionId,
});
};

sendAnswer = async (data: Omit<SendAnswerRequest, 'sessionId'>) => {
return runWithRetry(
handleFalsePositiveResponse(this.rpc.sendAnswer.bind(this.rpc)),
{
isRetryable: isRetryablePreset,
},
)({
return this.rpc.sendAnswer({
...data,
sessionId: this.sessionId,
});
Expand Down

0 comments on commit e57a81a

Please sign in to comment.