make the transport discovery lk edgecase a EC exclusive workaround

Dont add it to the sdk.
This commit is contained in:
Timo K.
2026-10-14 16:40:27 +02:00
parent 8638d4f159
commit 3b763d87f2
12 changed files with 206 additions and 201 deletions
+7 -11
View File
@@ -101,8 +101,8 @@ LiveKit participants.
│ create ───▶│ │ │
│ │ GET rtc/transports (session) ────────▶│ │
│ │◀── first transport of the backend's type │
│ │ (none: findRemotePublishTransport, │ │
│ │ a member's SFU we may publish on) ─▶│ │
│ │ (none, LiveKit only: a member's SFU │ │
│ │ that lets us publish, get_token) ─▶│ │
│ │ prepareLocalTransport (backend): │ │
│ │ publisher token: CS API get_token, │ │
│ │ or OpenID token then /sfu/get ─────▶│ │
@@ -539,10 +539,6 @@ type MemberMediaFields = Pick<RTCMember, "tracks$" | "encryptionError$">;
export interface MediaBackend {
readonly transportType: string; // "livekit"
/** Another member's transport we may publish on, where the client found none. */
findRemotePublishTransport(
memberships: CallMembership[],
): Promise<Transport | null>;
/** Authenticate with the transport the client found; the probe for delegation runs here. */
prepareLocalTransport(
transport: Transport,
@@ -562,9 +558,10 @@ export interface MediaBackend {
```
What stays on the client's side: discovery of the local transport from the
homeserver's list (a homeserver endpoint, so not a backend's), asking the
backend for another member's transport only where that list and the host's
fallback are empty, the membership
homeserver's list (a homeserver endpoint, so not a backend's) with, for the
LiveKit backend only, a last resort of another member's SFU that lets us
publish (`findRemotePublishLivekitTransport`, wired in by `RTCParticipation` rather
than by the backend interface, since it is an MSC4195 matter), the membership
state machine in `LocalMembership.ts` and its combination with
`local.connectionState$` into `state$`, the choice of delayed leave timings,
mapping a data packet's sender to a member, and the transport registry, which keys on the raw
@@ -574,8 +571,7 @@ transport serialised with sorted keys and derives `connectedTransports$` and eac
The backend's context carries no Matrix client and no membership list. A backend
that needs the client takes a `Pick` of exactly what it calls in its own options
(`createLivekitBackend(scope, context, { client, mediaQuality })`),
and learns of remote members only through `mediaFor$` and the one membership
snapshot `findRemotePublishTransport` is handed, registering each
and learns of remote members only through `mediaFor$`, registering each
membership's transport for as long as the member's scope lives. Media keys reach
it as a stream, `mediaKeys$`, replayed on subscribe; the js-sdk session never
does. A host supplies its own backend through `MatrixRTCClientOptions.backend`;