From 8be6655d8b889f2394f8fdfa28e04fb270e2739b Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Mon, 11 Nov 2024 16:53:37 +0000 Subject: [PATCH] Add matrix_rtc_session config options + bump js-sdk (#2756) * Add matrix_rtc_session config options * Bump js-sdk https://github.com/matrix-org/matrix-js-sdk/compare/6971e7bebaad643c233e5057da7a0d42441c0789...fcb69b16ad8d170c67ea844f83543d467bbd7707 Also brings in: - https://github.com/matrix-org/matrix-js-sdk/pull/4342 - https://github.com/matrix-org/matrix-js-sdk/pull/4494 --- package.json | 2 +- src/config/ConfigOptions.ts | 24 ++++++++++++++++++++++++ src/rtcSessionHelpers.ts | 8 +++++++- yarn.lock | 6 +++--- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5f54702fd..b7bb32dee 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "livekit-client": "^2.5.7", "lodash": "^4.17.21", "loglevel": "^1.9.1", - "matrix-js-sdk": "matrix-org/matrix-js-sdk#6971e7bebaad643c233e5057da7a0d42441c0789", + "matrix-js-sdk": "matrix-org/matrix-js-sdk#fcb69b16ad8d170c67ea844f83543d467bbd7707", "matrix-widget-api": "^1.8.2", "normalize.css": "^8.0.1", "observable-hooks": "^4.2.3", diff --git a/src/config/ConfigOptions.ts b/src/config/ConfigOptions.ts index 83e9bcc62..ed4d5bceb 100644 --- a/src/config/ConfigOptions.ts +++ b/src/config/ConfigOptions.ts @@ -96,6 +96,30 @@ export interface ConfigOptions { * Note that this can additionally be disabled by the app's URL parameters. */ app_prompt?: boolean; + + /** + * These are low level options that are used to configure the MatrixRTC session. + * Take care when changing these options. + */ + matrix_rtc_session?: { + /** + * How long (in milliseconds) to wait before rotating end-to-end media encryption keys + * when someone leaves a call. + */ + key_rotation_on_leave_delay?: number; + + /** + * How often (in milliseconds) keep-alive messages should be sent to the server for + * the MatrixRTC membership event. + */ + membership_keep_alive_period?: number; + + /** + * How long (in milliseconds) after the last keep-alive the server should expire the + * MatrixRTC membership event. + */ + membership_server_side_expiry_timeout?: number; + }; } // Overrides members from ConfigOptions that are always provided by the diff --git a/src/rtcSessionHelpers.ts b/src/rtcSessionHelpers.ts index d7f93ad2f..9e699319c 100644 --- a/src/rtcSessionHelpers.ts +++ b/src/rtcSessionHelpers.ts @@ -98,8 +98,9 @@ export async function enterRTCSession( // right now we assume everything is a room-scoped call const livekitAlias = rtcSession.room.roomId; + const { features, matrix_rtc_session: matrixRtcSessionConfig } = Config.get(); const useDeviceSessionMemberEvents = - Config.get().features?.feature_use_device_session_member_events; + features?.feature_use_device_session_member_events; rtcSession.joinRoomSession( await makePreferredLivekitFoci(rtcSession, livekitAlias), makeActiveFocus(), @@ -108,6 +109,11 @@ export async function enterRTCSession( ...(useDeviceSessionMemberEvents !== undefined && { useLegacyMemberEvents: !useDeviceSessionMemberEvents, }), + membershipServerSideExpiryTimeout: + matrixRtcSessionConfig?.membership_server_side_expiry_timeout, + membershipKeepAlivePeriod: + matrixRtcSessionConfig?.membership_keep_alive_period, + makeKeyDelay: matrixRtcSessionConfig?.key_rotation_on_leave_delay, }, ); } diff --git a/yarn.lock b/yarn.lock index 476994742..7e4b03708 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5998,9 +5998,9 @@ matrix-events-sdk@0.0.1: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd" integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA== -matrix-js-sdk@matrix-org/matrix-js-sdk#6971e7bebaad643c233e5057da7a0d42441c0789: +matrix-js-sdk@matrix-org/matrix-js-sdk#fcb69b16ad8d170c67ea844f83543d467bbd7707: version "34.10.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/6971e7bebaad643c233e5057da7a0d42441c0789" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/fcb69b16ad8d170c67ea844f83543d467bbd7707" dependencies: "@babel/runtime" "^7.12.5" "@matrix-org/matrix-sdk-crypto-wasm" "^9.0.0" @@ -6011,7 +6011,7 @@ matrix-js-sdk@matrix-org/matrix-js-sdk#6971e7bebaad643c233e5057da7a0d42441c0789: jwt-decode "^4.0.0" loglevel "^1.7.1" matrix-events-sdk "0.0.1" - matrix-widget-api "^1.8.2" + matrix-widget-api "^1.10.0" oidc-client-ts "^3.0.1" p-retry "4" sdp-transform "^2.14.1"