Allow sending room events in rtc sdk

This commit is contained in:
Timo K
2026-02-03 11:10:57 +01:00
parent 461a1f1b70
commit 18b771e620
2 changed files with 8 additions and 2 deletions

View File

@@ -99,7 +99,7 @@ export async function createMatrixRTCSdk(
const scope = new ObservableScope();
// widget client
initializeWidget(application);
initializeWidget(application, true);
const widget = _widget;
if (!widget) throw Error("No widget. This webapp can only start as a widget");
const client = await widget.client;

View File

@@ -68,7 +68,10 @@ export let widget: WidgetHelpers | null;
*/
// this needs to be a seperate call and cannot be done on import to allow us to spy on methods in here before
// execution.
export const initializeWidget = (rtcApplication: string = "m.call"): void => {
export const initializeWidget = (
rtcApplication: string = "m.call",
sendRoomEvents = false,
): void => {
try {
const {
widgetId,
@@ -116,6 +119,9 @@ export const initializeWidget = (rtcApplication: string = "m.call"): void => {
EventType.CallNotify, // Sent as a deprecated fallback
EventType.RTCNotification,
];
if (sendRoomEvents) {
sendEvent.push(EventType.RoomMessage);
}
const sendRecvEvent = [
"org.matrix.rageshake_request",
EventType.CallEncryptionKeysPrefix,