From 649281aedbf94f831c8a8318cefd0d3a9512b630 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Mon, 16 Dec 2024 11:12:23 +0000 Subject: [PATCH] Wait for .well-known/matrix/client to load before determining MatrixRTC foci --- src/rtcSessionHelper.test.ts | 2 +- src/rtcSessionHelpers.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rtcSessionHelper.test.ts b/src/rtcSessionHelper.test.ts index 7df9f1b3e..729545f71 100644 --- a/src/rtcSessionHelper.test.ts +++ b/src/rtcSessionHelper.test.ts @@ -40,7 +40,7 @@ test("It joins the correct Session", async () => { room: { roomId: "roomId", client: { - getClientWellKnown: vi.fn().mockReturnValue(clientWellKnown), + waitForClientWellKnown: vi.fn().mockResolvedValue(clientWellKnown), }, }, memberships: [], diff --git a/src/rtcSessionHelpers.ts b/src/rtcSessionHelpers.ts index f1c7eb8ce..680df5716 100644 --- a/src/rtcSessionHelpers.ts +++ b/src/rtcSessionHelpers.ts @@ -44,8 +44,9 @@ async function makePreferredLivekitFoci( } // Prioritize the client well known over the configured sfu. - const wellKnownFoci = - rtcSession.room.client.getClientWellKnown()?.[FOCI_WK_KEY]; + const wellKnownFoci = ( + await rtcSession.room.client.waitForClientWellKnown() + )?.[FOCI_WK_KEY]; if (Array.isArray(wellKnownFoci)) { preferredFoci.push( ...wellKnownFoci