Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ export class Call {
})
: previousSfuClient;
this.sfuClient = sfuClient;
this.unifiedSessionId ??= sfuClient.sessionId;
this.dynascaleManager.setSfuClient(sfuClient);

const clientDetails = await getClientDetails();
Expand Down Expand Up @@ -1008,6 +1009,7 @@ export class Call {
try {
const { callState, fastReconnectDeadlineSeconds, publishOptions } =
await sfuClient.join({
unifiedSessionId: this.unifiedSessionId,
subscriberSdp,
publisherSdp,
clientDetails,
Expand Down Expand Up @@ -1061,6 +1063,7 @@ export class Call {
statsOptions,
publishOptions: this.currentPublishOptions || [],
closePreviousInstances: !performingMigration,
unifiedSessionId: this.unifiedSessionId,
});
}

Expand Down Expand Up @@ -1222,6 +1225,7 @@ export class Call {
clientDetails: ClientDetails;
publishOptions: PublishOption[];
closePreviousInstances: boolean;
unifiedSessionId: string;
}) => {
const {
sfuClient,
Expand All @@ -1230,6 +1234,7 @@ export class Call {
statsOptions,
publishOptions,
closePreviousInstances,
unifiedSessionId,
} = opts;
const { enable_rtc_stats: enableTracing } = statsOptions;
if (closePreviousInstances && this.subscriber) {
Expand Down Expand Up @@ -1288,7 +1293,6 @@ export class Call {
this.tracer.setEnabled(enableTracing);
this.sfuStatsReporter?.stop();
if (statsOptions?.reporting_interval_ms > 0) {
this.unifiedSessionId ??= sfuClient.sessionId;
this.sfuStatsReporter = new SfuStatsReporter(sfuClient, {
clientDetails,
options: statsOptions,
Expand All @@ -1298,7 +1302,7 @@ export class Call {
camera: this.camera,
state: this.state,
tracer: this.tracer,
unifiedSessionId: this.unifiedSessionId,
unifiedSessionId,
});
this.sfuStatsReporter.start();
}
Expand Down
14 changes: 14 additions & 0 deletions packages/client/src/gen/video/sfu/event/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,14 @@ export interface JoinRequest {
* @generated from protobuf field: string session_id = 2;
*/
sessionId: string;
/**
* user_session id can change during reconnects, this helps us to
* identify the user across reconnects and should remain consistent until the user explicitly
* disconnects, is kicked or the call is ended.
*
* @generated from protobuf field: string unified_session_id = 13;
*/
unifiedSessionId: string;
/**
* dumb SDP that allow us to extract subscriber's decode codecs
*
Expand Down Expand Up @@ -1353,6 +1361,12 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
super('stream.video.sfu.event.JoinRequest', [
{ no: 1, name: 'token', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
{
no: 13,
name: 'unified_session_id',
kind: 'scalar',
T: 9 /*ScalarType.STRING*/,
},
{
no: 3,
name: 'subscriber_sdp',
Expand Down
Loading