Identify transports by server name as well as URLs

A transport with only a LiveKit SFU `url` has to be authenticated through
our own homeserver, which needs to know the name of the server owning the
SFU. Carry that name alongside the transport as a TransportLocator,
derived from the member's user ID for remote transports and from the
client's domain for our own, and key the connection map on the SFU URL,
the service URL and the server name together so that `url`, service URL
and combined transport shapes are deduplicated consistently.
This commit is contained in:
Robin
2026-10-12 10:31:36 +02:00
committed by Johannes Marbach
parent 83e1396bdd
commit 53a0e273d6
21 changed files with 257 additions and 182 deletions
@@ -6,19 +6,16 @@ Please see LICENSE in the repository root for full details.
*/
import { type LocalParticipant, type RemoteParticipant } from "livekit-client";
import {
type CallMembership,
type UnstableLivekitTransport,
} from "matrix-js-sdk/lib/matrixrtc";
import { type CallMembership } from "matrix-js-sdk/lib/matrixrtc";
import { combineLatest, filter, map } from "rxjs";
import { logger } from "matrix-js-sdk/lib/logger";
import { deepCompare } from "matrix-js-sdk/lib/utils";
import { type Behavior } from "../../Behavior";
import { type ConnectionMap } from "./ConnectionMap";
import { Epoch, type ObservableScope } from "../../ObservableScope";
import { type Connection } from "./Connection";
import { generateItemsWithEpoch } from "../../../utils/observable";
import { type TransportLocator } from "../../../livekit/auth";
interface LocalTaggedParticipant {
type: "local";
@@ -62,7 +59,7 @@ interface Props {
scope: ObservableScope;
membershipsWithTransport$: Behavior<
Epoch<
{ membership: CallMembership; transport?: UnstableLivekitTransport }[]
{ membership: CallMembership; transport: TransportLocator | undefined }[]
>
>;
connectionMap$: Behavior<Epoch<ConnectionMap>>;
@@ -163,14 +160,3 @@ export function createRemoteMatrixLivekitMembers$({
}
// TODO add back in the callviewmodel pauseWhen(this.pretendToBeDisconnected$)
// TODO add this to the JS-SDK
export function areLivekitTransportsEqual<T extends UnstableLivekitTransport>(
t1: T | null,
t2: T | null,
): boolean {
if (t1 && t2) {
return deepCompare(t1, t2);
}
return !t1 && !t2;
}