From 72ca3821abbd7b983243449624fb571cc7f96a22 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 13 Jan 2026 12:37:46 +0100 Subject: [PATCH 1/4] Change the livekit alias to just be the room id for backwards compatibility. --- .../CallViewModel/localMember/LocalTransport.ts | 13 ++++++++++++- .../remoteMembers/MatrixLivekitMembers.ts | 10 +++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/state/CallViewModel/localMember/LocalTransport.ts b/src/state/CallViewModel/localMember/LocalTransport.ts index 6e0e56a3..5229b700 100644 --- a/src/state/CallViewModel/localMember/LocalTransport.ts +++ b/src/state/CallViewModel/localMember/LocalTransport.ts @@ -250,7 +250,18 @@ async function makeTransport( transport: { type: "livekit", livekit_service_url: url, - livekit_alias: sfuConfig.livekitAlias, + // WARNING PLS READ ME!!! + // This looks unintuitive especially considering that `sfuConfig.livekitAlias` exists. + // Why do we not use: `livekit_alias: sfuConfig.livekitAlias` + // + // - This is going to be used for sending our state event transport (focus_preferred) + // - In sticky events it is expected to NOT send this field at all. The transport is only the `type`, `livekit_service_url` + // - If we set it to the hased alias we get from the jwt, we will end up using the hashed alias as the body.roomId field + // in v0.16.0. (It will use oldest member transport. It is using the transport.livekit_alias as the body.roomId) + // + // TLDR this is a temporal fild that allow for comaptibilty but the spec expects it to not exists. (but its existance also does not break anything) + // It is just named poorly: It was intetended to be the actual alias. But now we do pseudonymys ids so we use a hashed alias. + livekit_alias: roomId, }, sfuConfig, }; diff --git a/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts b/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts index 10a3e2cb..24e18af2 100644 --- a/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts +++ b/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts @@ -143,9 +143,13 @@ export function areLivekitTransportsEqual( t1: T | null, t2: T | null, ): boolean { - if (t1 && t2) return t1.livekit_service_url === t2.livekit_service_url; - // In case we have different lk rooms in the same SFU (depends on the livekit authorization service) - // It is only needed in case the livekit authorization service is not behaving as expected (or custom implementation) + if (t1 && t2) + return ( + t1.livekit_service_url === t2.livekit_service_url && + // In case we have different lk rooms in the same SFU (depends on the livekit authorization service) + // It is only needed in case the livekit authorization service is not behaving as expected (or custom implementation) + t1.livekit_alias === t2.livekit_alias + ); if (!t1 && !t2) return true; return false; } From d185b52091e7d0e020daddbab94b0086dcdfbb16 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 13 Jan 2026 12:44:17 +0100 Subject: [PATCH 2/4] more docstrings to docuemnt the migration away from livekit_alias --- .../localMember/LocalTransport.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/state/CallViewModel/localMember/LocalTransport.ts b/src/state/CallViewModel/localMember/LocalTransport.ts index 5229b700..7f87c392 100644 --- a/src/state/CallViewModel/localMember/LocalTransport.ts +++ b/src/state/CallViewModel/localMember/LocalTransport.ts @@ -68,6 +68,27 @@ export enum JwtEndpointVersion { Matrix_2_0 = "matrix_2_0", } +// TODO livekit_alias-cleanup +// 1. We need to move away from transports map to connections!!! +// +// 2. We need to stop sending livekit_alias all together +// +// +// 1. +// Transports are just the jwt service adress but do not contain the information which room on this transport to use. +// That requires slot and roomId. +// +// We need one connection per room on the transport. +// +// We need an object that contains: +// transport +// roomId +// slotId +// +// To map to the connections. Prosposal: `ConnectionIdentifier` +// +// 2. +// We need to make sure we do not sent livekit_alias in sticky events and that we drop all code for sending state events! export interface LocalTransportWithSFUConfig { transport: LivekitTransport; sfuConfig: SFUConfig; From 4d35b77077b86f619529c3b10fa74da0d816a128 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 13 Jan 2026 17:41:46 +0100 Subject: [PATCH 3/4] bump jwt docker --- dev-backend-docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-backend-docker-compose.yml b/dev-backend-docker-compose.yml index 0efefd07..28682a33 100644 --- a/dev-backend-docker-compose.yml +++ b/dev-backend-docker-compose.yml @@ -3,7 +3,7 @@ networks: services: auth-service: - image: ghcr.io/element-hq/lk-jwt-service:pr_139 + image: ghcr.io/element-hq/lk-jwt-service:sha-f8ddd00 pull_policy: always hostname: auth-server environment: @@ -25,7 +25,7 @@ services: - ecbackend auth-service-1: - image: ghcr.io/element-hq/lk-jwt-service:pr_139 + image: ghcr.io/element-hq/lk-jwt-service:sha-f8ddd00 pull_policy: always hostname: auth-server-1 environment: From 41eb45b3c46340e35d6999b0cc2f4bf34be27324 Mon Sep 17 00:00:00 2001 From: Timo K Date: Wed, 14 Jan 2026 12:29:22 +0100 Subject: [PATCH 4/4] fix comments --- src/state/CallViewModel/localMember/LocalTransport.ts | 2 +- src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/state/CallViewModel/localMember/LocalTransport.ts b/src/state/CallViewModel/localMember/LocalTransport.ts index 7f87c392..0625866d 100644 --- a/src/state/CallViewModel/localMember/LocalTransport.ts +++ b/src/state/CallViewModel/localMember/LocalTransport.ts @@ -280,7 +280,7 @@ async function makeTransport( // - If we set it to the hased alias we get from the jwt, we will end up using the hashed alias as the body.roomId field // in v0.16.0. (It will use oldest member transport. It is using the transport.livekit_alias as the body.roomId) // - // TLDR this is a temporal fild that allow for comaptibilty but the spec expects it to not exists. (but its existance also does not break anything) + // TLDR this is a temporal field that allow for comaptibilty but the spec expects it to not exists. (but its existance also does not break anything) // It is just named poorly: It was intetended to be the actual alias. But now we do pseudonymys ids so we use a hashed alias. livekit_alias: roomId, }, diff --git a/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts b/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts index 24e18af2..4ac9753f 100644 --- a/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts +++ b/src/state/CallViewModel/remoteMembers/MatrixLivekitMembers.ts @@ -148,6 +148,7 @@ export function areLivekitTransportsEqual( t1.livekit_service_url === t2.livekit_service_url && // In case we have different lk rooms in the same SFU (depends on the livekit authorization service) // It is only needed in case the livekit authorization service is not behaving as expected (or custom implementation) + // Also LivekitTransport is planned to become a `ConnectionIdentifier` which moves this equal somewhere else. t1.livekit_alias === t2.livekit_alias ); if (!t1 && !t2) return true;