Skip to content

Commit 92afd5d

Browse files
authored
Wait for .well-known/matrix/client to load before determining MatrixRTC foci (#2901)
1 parent a723f10 commit 92afd5d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/rtcSessionHelper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test("It joins the correct Session", async () => {
4040
room: {
4141
roomId: "roomId",
4242
client: {
43-
getClientWellKnown: vi.fn().mockReturnValue(clientWellKnown),
43+
waitForClientWellKnown: vi.fn().mockResolvedValue(clientWellKnown),
4444
},
4545
},
4646
memberships: [],

src/rtcSessionHelpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ async function makePreferredLivekitFoci(
4444
}
4545

4646
// Prioritize the client well known over the configured sfu.
47-
const wellKnownFoci =
48-
rtcSession.room.client.getClientWellKnown()?.[FOCI_WK_KEY];
47+
const wellKnownFoci = (
48+
await rtcSession.room.client.waitForClientWellKnown()
49+
)?.[FOCI_WK_KEY];
4950
if (Array.isArray(wellKnownFoci)) {
5051
preferredFoci.push(
5152
...wellKnownFoci

0 commit comments

Comments
 (0)