diff --git a/changelogs/client_server/newsfragments/2480.feature b/changelogs/client_server/newsfragments/2480.feature new file mode 100644 index 000000000..c3a6fcc1f --- /dev/null +++ b/changelogs/client_server/newsfragments/2480.feature @@ -0,0 +1 @@ +Add "MatrixRTC" including the `m.rtc.slot` state event, the `m.rtc.member` message event and the `m.rtc.encryption_key` to-device message, as per [MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143). diff --git a/changelogs/client_server/newsfragments/2480.new b/changelogs/client_server/newsfragments/2480.new new file mode 100644 index 000000000..f7273c71b --- /dev/null +++ b/changelogs/client_server/newsfragments/2480.new @@ -0,0 +1 @@ +Add `GET /_matrix/client/v1/rtc/transports` as per [MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143). diff --git a/content/client-server-api/_index.md b/content/client-server-api/_index.md index 9516ce953..0d95e7465 100644 --- a/content/client-server-api/_index.md +++ b/content/client-server-api/_index.md @@ -4380,6 +4380,7 @@ that profile. | [Moderation Policy Lists](#moderation-policy-lists) | Optional | Optional | Optional | Optional | Optional | | [Policy Servers](#policy-servers) | Optional | Optional | Optional | Optional | Optional | | [OpenID](#openid) | Optional | Optional | Optional | Optional | Optional | +| [Real-Time Communication (MatrixRTC)](#matrixrtc) | Optional | Optional | Optional | Optional | Optional | | [Recently used emoji](#recently-used-emoji) | Optional | Optional | Optional | Optional | Optional | | [Reference Relations](#reference-relations) | Optional | Optional | Optional | Optional | Optional | | [Reporting Content](#reporting-content) | Optional | Optional | Optional | Optional | Optional | @@ -4495,3 +4496,4 @@ systems. {{% cs-module name="Mutual Rooms" filename="mutual_rooms" %}} {{% cs-module name="Delayed Events" filename="delayed_events" %}} {{% cs-module name="Sticky Events" filename="sticky_events" %}} +{{% cs-module name="Real-Time Communication (MatrixRTC)" filename="matrixrtc" %}} diff --git a/content/client-server-api/modules/guest_access.md b/content/client-server-api/modules/guest_access.md index 3999388b7..bbe0c8356 100644 --- a/content/client-server-api/modules/guest_access.md +++ b/content/client-server-api/modules/guest_access.md @@ -86,6 +86,11 @@ for sending and managing [delayed events](#delayed-events): * {{% added-in v="1.20" %}} [POST /delayed_events/{delayId}/cancel](#post_matrixclientv1delayed_eventsdelayidcancel) * {{% added-in v="1.20" %}} [POST /delayed_events/{delayId}/restart](#post_matrixclientv1delayed_eventsdelayidrestart) +The following API endpoints are allowed to be accessed by guest accounts +for [MatrixRTC](#matrixrtc): + +* {{% added-in v="1.20" %}} [GET /rtc/transports](#get_matrixclientv1rtctransports) + #### Server behaviour Servers MUST only allow guest users to join rooms if the diff --git a/content/client-server-api/modules/matrixrtc.md b/content/client-server-api/modules/matrixrtc.md new file mode 100644 index 000000000..81c63018a --- /dev/null +++ b/content/client-server-api/modules/matrixrtc.md @@ -0,0 +1,307 @@ +### Real-Time Communication (MatrixRTC) {#matrixrtc} + +{{% added-in v="1.20" %}} + +MatrixRTC is a generalised framework for building real-time communication (RTC) +experiences, such as voice and video calls. These experiences are referred to as +[applications](#matrixrtc-applications). Within applications, the actual RTC data +is exchanged using [transports](#matrixrtc-transports). What kind of application +may run in a room and under what configuration is governed by [slots](#slots), which +are represented as [`m.rtc.slot`](#mrtcslot) state events. Clients join and leave +slots via [`m.rtc.member`](#mrtcmember) message events, which also advertise the +concrete transports in use. Finally, clients can protect RTC data using transport-level +[encryption](#matrixrtc-encryption) mechanisms. + +#### Core framework + +##### Events + +{{% event event="m.rtc.slot" %}} + +{{% event event="m.rtc.member" %}} + +{{% event event="m.rtc.encryption_key" %}} + +##### Applications {#matrixrtc-applications} + +A MatrixRTC application defines a concrete RTC experience, for instance having a +voice or video call or editing a document collaboratively. Each application has +a `type`, which acts as its globally unique identifier and MUST follow the +[Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + +Additionally, each application defines a predictable scheme for constructing slot +ID suffixes. These are used to distinguish multiple instances of the same application +running in different [slots](#slots) and MUST also follow the +[Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar) +but without the namespacing requirements. + +##### Transports {#matrixrtc-transports} + +MatrixRTC transports describe the concrete mechanism by which clients publish and +subscribe to RTC data. Each transport has a `type`, which acts as its globally unique +identifier and MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + +###### Client Behaviour + +Some transports may require server-side infrastructure such as SFUs or TURN servers. +Clients can discover the availability of such infrastructure and any potentially required +connection details via [`GET /rtc/transports`](#get_matrixclientv1rtctransports). + +{{% http-api spec="client-server" api="rtc" %}} + +##### Slots + +A slot in MatrixRTC is a state event of the type [`m.rtc.slot`](#mrtcslot). Room +administrators can use slots to define what MatrixRTC applications are allowed to +run in a room and which settings they should use. + +Each slot is tied to a specific application instance via its slot ID. This ID +is stored in the slot's `state_key` and MUST be constructed as follows: + +``` +slot_id = {type}#{suffix} +``` + +Here, `type` is the globally unique identifier of the [application](#matrixrtc-applications) +and `suffix` is a valid slot ID suffix for the application. + +{{% boxes/note %}} +As an example, consider an application with a `type` of `org.example.app` that only +supports a single instance per room with a fixed slot ID suffix of `default`. As per +the definition above, the only allowed slot ID for such an application instance is +`org.example.app#default`. +{{% /boxes/note %}} + +Slot IDs MUST NOT exceed the [maximum allowed length of `state_key`](#size-limits). +Furthermore, implementations MUST treat slot IDs as opaque and refrain from parsing +the components used to construct a slot ID back out of it. + +###### Client Behaviour + +Clients can open slots by sending an [`m.rtc.slot`](#mrtcslot) state event with `status` +equal to `open`, a valid `application` object and, if needed, a valid `encryption` +object. Any slot that doesn't fulfill these requirements MUST be treated as closed. + +To explicitly close an open slot, clients can update the associated [`m.rtc.slot`](#mrtcslot) +state event by setting `status` to `closed`. The `application` and `encryption` objects +are not required on closed slots but MAY be kept around for convenience to simplify +re-opening the slot. + +The semantics of open and closed slots for actual slot membership are described in +the [membership section](#matrixrtc-membership) below. + +###### Server Behaviour + +Servers SHOULD include [`m.rtc.slot`](#mrtcslot) events in the set of state events +that are replicated during [room upgrades](#room-upgrades). + +##### Membership {#matrixrtc-membership} + +Membership in slots is expressed via [`m.rtc.member`](#mrtcmember) message events. + +###### Client Behaviour + +Clients MUST send [`m.rtc.member`](#mrtcmember) events as [sticky events](#sticky-events). +The RECOMMENDED sticky duration is 1 hour. Additionally, clients MUST implement +the [ephemeral map algorithm](#building-ephemeral-state-like-maps) to construct +a state-like store of membership events. + +{{% boxes/rationale %}} +Sticky events provide the same delivery guarantee that state events have, which +is essential for RTC use cases. At the same time, sticky events avoid some of +the drawbacks of state events such as state bloat, power level restrictions and +lack of encryption. +{{% /boxes/rationale %}} + +Different membership events for the same user are distinguished using the +`member.id` property, which doubles up as the `sticky_key` used in the +[ephemeral map algorithm](#building-ephemeral-state-like-maps). Clients MUST +generate a new value for this property from a cryptographically secure random +number generator each time they join or re-join a slot. This includes the case +where a client is already joined to the slot through a different [`m.rtc.member`](#mrtcmember) +event. + +{{% boxes/rationale %}} +Using non-deterministic member IDs allows transports to pseudonymize members +against external services. +{{% /boxes/rationale %}} + +Clients advertise the transports they have published and are able to subscribe +to in the `transports.published` and `transports.can_subscribe` properties, +respectively. Since publishing transports will usually incur a certain performance +cost, clients SHOULD only publish transports that are actually required, based +on the `transports.can_subscribe` values from other joined membership events. + +An [`m.rtc.member`](#mrtcmember) event MUST only be considered joined if +all of the following conditions apply: + +- The event matches the event schema for [`m.rtc.member`](#mrtcmember) events. +- The `member.membership` property is set to `join`. +- The event's sender is currently a member of the room with membership `join`. +- The event is currently [sticky](#sticky-events), meaning its stickiness + duration has not yet expired. +- The event was sent encrypted if the room is encrypted, or unencrypted if the + room is unencrypted. See the section on encryption [below](#matrixrtc-encryption) + for further details. +- An [`m.rtc.slot`](#mrtcslot) event exists in the room and has the following + properties: + - The event matches the event schema for [`m.rtc.slot`](#mrtcslot) events. + - The `status` property is set to `open`. + - The `state_key` property equals the [`m.rtc.member`](#mrtcmember) event's + `slot_id`. + - The `application.type` property equals the [`m.rtc.member`](#mrtcmember) + event's `application.type`. + - The `encryption` property is set to a valid value if the room is encrypted, + or absent if the room is unencrypted. See the section on encryption + [below](#matrixrtc-encryption) for further details. + +If any of these conditions is not fulfilled, clients MUST treat the member as left and +refrain from connecting to their transports. + +As the resolved join state is constrained by the associated [`m.rtc.slot`](#mrtcslot) +event, clients MUST constantly react to and respect the latest room state. To avoid +unexpectedly re-joining a slot when it is reopened, clients SHOULD leave the slot +by sending an explicit [`m.rtc.member`](#mrtcmember) event with `member.membership` +set to `leave` when the slot is closed. Clients MAY apply a suitable delay between +the slot being closed and sending the leaving event. + +Since the resolved join state of an [`m.rtc.member`](#mrtcmember) event is also +constrained by its stickiness, clients need to send a new [`m.rtc.member`](#mrtcmember) +event if they want to stay joined for longer than the event's stickiness duration. +It is RECOMMENDED that clients send these events sufficiently ahead of the stickiness +expiration to minimize potential join state flickering on other clients. + +Clients can voluntarily leave a slot by sending an [`m.rtc.member`](#mrtcmember) +event with `member.membership` equal to `leave`. In this case, the `leave_reason` +property can optionally provide context on the cause for leaving. Clients SHOULD only +populate this property if they actually attempted to join the slot before. + +To ensure that the membership view remains consistent when clients unexpectedly +lose connectivity, clients SHOULD use [delayed events](#delayed-events) to +implement a "dead man's switch". This means scheduling the leaving [`m.rtc.member`](#mrtcmember) +event as a delayed event with a reasonably short delay (e.g. 15-30 seconds) directly +after joining. While connected, the client then periodically +[restarts](#post_matrixclientv1delayed_eventsdelayidrestart) the delayed event to +push it into the future. If the client happens to lose connectivity and the +delay times out, the homeserver will automatically send the leaving +[`m.rtc.member`](#mrtcmember) event. + +##### End-to-end encryption {#matrixrtc-encryption} + +MatrixRTC supports transport-level encryption, which is applied on top of the +[end-to-end encryption](#end-to-end-encryption) for message events and to-device +messages. This involves the establishment of shared generic key material by way +of an encryption mechanism, as prescribed by the `encryption` property of +[`m.rtc.slot`](#mrtcslot) events. Once established, the generic key material +is fed into transport-specific encryption mechanisms (which may derive further +secrets from it). + +Each encryption mechanism has a `type`, which acts as its globally unique +identifier and MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). +The only currently defined encryption mechanism `type` is `m.per_member`. + +```json +{ + "type": "m.rtc.slot", + "state_key": "org.example.app#default", + "content": { + "status": "open", + "application": { + "type": "org.example.app" + }, + "encryption": { + "type": "m.per_member" + } + } +} +``` + +###### Client Behaviour + +Use of encryption in MatrixRTC is REQUIRED in encrypted rooms. This means that +[`m.rtc.member`](#mrtcmember) events MUST be encrypted and [`m.rtc.slot`](#mrtcslot) +events MUST contain an `encryption` object when sent in an encrypted room. Member +and slot events that violate these conditions MUST be considered left and closed, +respectively. Similarly, clients MUST ignore unencrypted RTC data when connected to +an encrypted slot. Finally, when clients encounter an unknown RTC encryption type +in an encrypted room, they MUST refrain from connecting to the respective slot. + +Conversely, MatrixRTC encryption MUST NOT be used in unencrypted rooms. +This is because the only currently defined encryption mechanism, `m.per_member`, +depends on the authentication of encrypted events and to-device messages. + +As a result, when room encryption is later enabled in a previously unencrypted +room, any existing [`m.rtc.slot`](#mrtcslot) events are invalidated and will +have to be updated with an appropriate `encryption` object. Unless clients receive +the updated [`m.rtc.slot`](#mrtcslot) event together with the [`m.room.encryption`](#mroomencryption) +event, they MUST leave any joined slots in the affected room immediately. + +**`m.per_member` encryption** + +Under `m.per_member`, every member maintains a unique sender key. This key is +shared securely with other members via Olm-encrypted [to-device messages](#send-to-device-messaging). + +When joining a slot that prescribes the `m.per_member` mechanism, clients MUST +generate a key of `N` bytes using a cryptographically secure random number +generator. The key length `N` depends on which transports the client is publishing. +Clients MUST use a key length that is large enough to satisfy all published +transports. + +{{% boxes/note %}} +Since clients use a joint secret when publishing more than one transport, transports +need to account for excess bytes beyond their own key length requirement in their +encryption scheme. +{{% /boxes/note %}} + +Once the key is generated, clients MUST share it with other clients joined to the +slot by sending encrypted to-device messages of the type +[`m.rtc.encryption_key`](#mrtcencryption_key). + +The recipient devices MUST be determined from the [`m.rtc.member`](#mrtcmember) events +that are considered to be joined to the slot, as per the rules [above](#matrixrtc-membership). +Once the member events have been determined, the [`m.rtc.encryption_key`](#mrtcencryption_key) +to-device messages MUST be sent to the devices that were used to encrypt these member +events. These devices are determined by following the existing processes for +[cryptographic validation](#validation-of-incoming-decrypted-events) of the +sending devices of encrypted room messages. + +Receiving clients MUST determine the sender's [`m.rtc.member`](#mrtcmember) event by +matching its `member.id` with the value of `member_id` in the [`m.rtc.encryption_key`](#mrtcencryption_key) +message. Once the member event has been determined, clients MUST verify that the +sender and the device that was used to send the member event match the sender and +device of the to-device message. Otherwise, the message MUST be discarded. + +Clients SHOULD discard [`m.rtc.encryption_key`](#mrtcencryption_key) events that +were sent in cleartext or whose sending device is not [cross-signed](#cross-signing) +by its owner. + +To ensure confidentiality, clients SHOULD rotate and redistribute their sender +key whenever the set of members that are considered joined to the slot changes. +Additionally, clients SHOULD rotate their sender key on a periodic schedule +regardless of whether the members have changed. This limits the impact of +compromised keys. + +In order to account for the delivery latency of to-device messages, clients +SHOULD add a short delay after sending a new key before starting to use it. +Otherwise, receiving members may temporarily be unable to decrypt the sender's +RTC data. The RECOMMENDED delay duration is 5 seconds. Similarly, clients +SHOULD store received keys even if they cannot identify the associated +[`m.rtc.member`](#mrtcmember) event, in order to account for the to-device +message arriving before the membership event. + +Finally, clients MAY apply some flexibility to exactly when a rotation +happens relative to a membership change, in order to avoid flooding all +members with to-device messages in short succession. + +{{% boxes/warning %}} +Delaying key rotations introduces a time window in which joining or leaving +members can decrypt media that is outside their actual membership period. +{{% /boxes/warning %}} + +##### Security considerations + +Clients SHOULD notify their users about the existence of RTC streams or +identities discovered from transports that cannot be mapped to any [`m.rtc.member`](#mrtcmember) +event in the slot. Such streams can signal an eavesdropping or impersonation +attack, which is why it is important not to ignore them outright. The way +clients notify their user about this is left as an implementation detail. diff --git a/content/client-server-api/modules/room_upgrades.md b/content/client-server-api/modules/room_upgrades.md index 702ab65f5..7cfee7e7f 100644 --- a/content/client-server-api/modules/room_upgrades.md +++ b/content/client-server-api/modules/room_upgrades.md @@ -64,6 +64,7 @@ They must be explicitly set during the `/upgrade` call. - `m.room.history_visibility` - `m.room.join_rules` - `m.room.power_levels` + - {{% added-in v="1.20" %}} [`m.rtc.slot`](#mrtcslot) Membership events should not be transferred to the new room due to technical limitations of servers not being able to impersonate diff --git a/data/api/client-server/rtc.yaml b/data/api/client-server/rtc.yaml new file mode 100644 index 000000000..a614a63d8 --- /dev/null +++ b/data/api/client-server/rtc.yaml @@ -0,0 +1,93 @@ +# Copyright 2026 The Matrix.org Foundation C.I.C. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +openapi: 3.1.0 +info: + title: Matrix Client-Server MatrixRTC API + version: 1.0.0 +paths: + /rtc/transports: + get: + x-addedInMatrixVersion: "1.20" + summary: Get the MatrixRTC transports supported by the homeserver. + description: |- + Retrieves the MatrixRTC transport types that the homeserver supports, + along with any potentially required connection details. + operationId: getRtcTransports + security: + - accessTokenBearer: [] + responses: + "200": + description: The transports supported by the homeserver. + content: + application/json: + schema: + type: object + properties: + transports: + type: array + description: |- + The transports the homeserver supports, ordered descendingly + by the server's preference. + items: + type: object + title: Transport + description: |- + Details on a specific transport. + properties: + type: + type: string + description: |- + The globally unique transport identifier. + + MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + additionalProperties: + description: Additional properties based on the transport `type`. + required: + - type + required: + - transports + examples: + response: + value: { + "transports": [ + { + "type": "org.example.transport", + "org.example.url": "wss://transport.example.org" + } + ] + } + "429": + description: This request was rate-limited. + content: + application/json: + schema: + $ref: definitions/errors/rate_limited.yaml + tags: + - MatrixRTC +servers: + - url: "{protocol}://{hostname}{basePath}" + variables: + protocol: + enum: + - http + - https + default: https + hostname: + default: localhost:8008 + basePath: + default: /_matrix/client/v1 +components: + securitySchemes: + accessTokenBearer: + $ref: definitions/security.yaml#/accessTokenBearer diff --git a/data/event-schemas/examples/m.rtc.encryption_key.yaml b/data/event-schemas/examples/m.rtc.encryption_key.yaml new file mode 100644 index 000000000..611522891 --- /dev/null +++ b/data/event-schemas/examples/m.rtc.encryption_key.yaml @@ -0,0 +1,11 @@ +{ + "type": "m.rtc.encryption_key", + "content": { + "room_id": "!726s6s6q:example.org", + "member_id": "zG2hvcAFcqAxrjXBwASV", + "media_key": { + "index": 0, + "key": "/Kkz0yfqfnpPV/+XeyqTuEgp2IMxGczqMoasYEFDhuY" + } + } +} diff --git a/data/event-schemas/examples/m.rtc.member.yaml b/data/event-schemas/examples/m.rtc.member.yaml new file mode 100644 index 000000000..868a95819 --- /dev/null +++ b/data/event-schemas/examples/m.rtc.member.yaml @@ -0,0 +1,30 @@ +{ + "$ref": "core/room_event.json", + "type": "m.rtc.member", + "sticky": { + "duration_ms": 3600000 + }, + "content": { + "slot_id": "org.example.application#default", + "member": { + "id": "zG2hvcAFcqAxrjXBwASV", + "membership": "join" + }, + "application": { + "type": "org.example.application", + "org.example.muted": false + }, + "transports": { + "published": [ + { + "type": "org.example.transport", + "org.example.websocket": "wss://call.example.org/zG2hvcAFcqAxrjXBwASV" + } + ], + "can_subscribe": [ + "m.livekit" + ] + }, + "sticky_key": "zG2hvcAFcqAxrjXBwASV" + } +} diff --git a/data/event-schemas/examples/m.rtc.slot.yaml b/data/event-schemas/examples/m.rtc.slot.yaml new file mode 100644 index 000000000..55a6c7e3d --- /dev/null +++ b/data/event-schemas/examples/m.rtc.slot.yaml @@ -0,0 +1,14 @@ +{ + "$ref": "core/state_event.json", + "type": "m.rtc.slot", + "state_key": "org.example.application#default", + "content": { + "status": "open", + "application": { + "type": "org.example.application" + }, + "encryption": { + "type": "m.per_member" + } + } +} diff --git a/data/event-schemas/schema/m.rtc.encryption_key.yaml b/data/event-schemas/schema/m.rtc.encryption_key.yaml new file mode 100644 index 000000000..43d322dcf --- /dev/null +++ b/data/event-schemas/schema/m.rtc.encryption_key.yaml @@ -0,0 +1,61 @@ +--- +$schema: https://json-schema.org/draft/2020-12/schema + +allOf: + - $ref: core-event-schema/event.yaml +description: |- + This event type is used as part of the `m.per_member` + [encryption](/client-server-api/#matrixrtc-encryption) mechanism + to share the generic key material used for transport-level encryption + with other members. + + It is encrypted as an + [`m.room.encrypted`](/client-server-api/#mroomencrypted) [to-device + event](/client-server-api/#send-to-device-messaging) using + [Olm](/client-server-api/#molmv1curve25519-aes-sha2). +properties: + content: + properties: + room_id: + type: string + format: mx-room-id + pattern: "^!" + description: |- + The [room ID](/appendices/#room-ids) associated with the + [`m.rtc.member`](/client-server-api/#mrtcmember) event. + member_id: + type: string + description: |- + The `member.id` value of the + [`m.rtc.member`](/client-server-api/#mrtcmember) event. + media_key: + type: object + title: MediaKey + description: Information on the key material. + properties: + key: + type: string + description: |- + The key material in raw bytes encoded using + [unpadded base64](/appendices/#unpadded-base64). + index: + type: integer + minimum: 0 + maximum: 255 + description: |- + The rolling index of the key to distinguish it from other keys. + MUST be between 0 and 255 inclusive. + required: + - key + - index + required: + - room_id + - member_id + - media_key + type: object + type: + enum: + - m.rtc.encryption_key + type: string +title: MatrixRTC encryption key +type: object diff --git a/data/event-schemas/schema/m.rtc.member.yaml b/data/event-schemas/schema/m.rtc.member.yaml new file mode 100644 index 000000000..6bd9148ac --- /dev/null +++ b/data/event-schemas/schema/m.rtc.member.yaml @@ -0,0 +1,139 @@ +--- +$schema: https://json-schema.org/draft/2020-12/schema + +allOf: + - $ref: core-event-schema/room_event.yaml +description: |- + This event is used to declare [membership](/client-server-api/#matrixrtc-membership) + for a given [MatrixRTC slot](/client-server-api/#slots). + + It is sent as a [sticky event](/client-server-api/#sticky-events). +properties: + content: + properties: + slot_id: + type: string + description: |- + The `state_key` of the associated [`m.rtc.slot`](/client-server-api/#mrtcslot) + event. + member: + type: object + title: Member + description: Details about the member and their membership status. + properties: + id: + type: string + description: |- + Identifier to distinguish the member. + membership: + type: string + enum: + - join + - leave + description: | + The intended membership status. + + Note that receivers resolve the actual membership status at a given time + as per the rules for [slot membership](/client-server-api/#matrixrtc-membership). + required: + - id + - membership + application: + type: object + title: Application + description: |- + Information about the MatrixRTC application running in the slot. + + REQUIRED if `member.membership` is `join`. + properties: + type: + type: string + description: |- + The globally unique application identifier. + + MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + + MUST align with the value of `slot_id` as per the rules for + [slots](/client-server-api/#slots). + additionalProperties: + description: Additional properties based on the application `type`. + required: + - type + transports: + type: object + title: Transports + description: |- + Details on the MatrixRTC transports used and supported by this member. + properties: + published: + type: array + description: |- + The transports on which the member is publishing media. + items: + type: object + title: Transport + description: |- + A specific transport on which the member is publishing media. + properties: + type: + type: string + description: |- + The globally unique transport identifier. + + MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + additionalProperties: + description: Additional properties based on the transport `type`. + required: + - type + can_subscribe: + type: array + description: |- + The transport types that the member is able to subscribe to, should + another member publish media on them. + items: + type: string + leave_reason: + type: object + title: LeaveReason + description: |- + If `member.membership` is `leave`, optionally provides context on why + the client left. Otherwise, absent. + properties: + code: + type: string + description: |- + Identifier for the specific leave reason. + + MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar) + but without the namespacing requirement. + + MUST be one of the following: + + * `leave`: The member left intentionally (e.g. by hanging up a call). + * `delayed_leave`: The member left through a scheduled delayed + leave event. + * `slot_closed`: The member left because the slot was closed + midway through the session. + reason: + type: string + description: Optional human-readable explanation of the leave reason. + required: + - code + sticky_key: + type: string + description: |- + The key to use in the + [ephemeral map algorithm](/client-server-api/#building-ephemeral-state-like-maps). + + MUST have the same value as `member.id`. + required: + - slot_id + - member + - sticky_key + type: object + type: + enum: + - m.rtc.member + type: string +title: MatrixRTC membership +type: object diff --git a/data/event-schemas/schema/m.rtc.slot.yaml b/data/event-schemas/schema/m.rtc.slot.yaml new file mode 100644 index 000000000..2fab47fa5 --- /dev/null +++ b/data/event-schemas/schema/m.rtc.slot.yaml @@ -0,0 +1,78 @@ +--- +$schema: https://json-schema.org/draft/2020-12/schema + +allOf: + - $ref: core-event-schema/state_event.yaml +description: |- + This event describes a [slot](/client-server-api/#slots) in which MatrixRTC + applications can run. +properties: + content: + properties: + status: + type: string + enum: + - open + - closed + description: |- + The slot's current status. + application: + type: object + title: Application + description: |- + Details about the application that can run in this slot. + + REQUIRED if `status` is `open`. + properties: + type: + type: string + description: |- + The globally unique application identifier. + + MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + + MUST align with the event's `state_key` as per the rules for + [slots](/client-server-api/#slots). + additionalProperties: + description: Additional properties based on the application `type`. + required: + - type + encryption: + type: object + title: Encryption + description: |- + Information about the [encryption](/client-server-api/#matrixrtc-encryption) + mechanism to use in this slot. + + If absent, encryption is disabled. + + REQUIRED in encrypted rooms. MUST NOT be set in unencrypted rooms. + properties: + type: + type: string + enum: + - m.per_member + description: |- + The globally unique identifier of the encryption mechanism. + + MUST follow the [Common Namespaced Identifier Grammar](/appendices#common-namespaced-identifier-grammar). + additionalProperties: + description: Additional properties based on the encryption mechanism `type`. + required: + - type + required: + - status + type: object + state_key: + description: |- + The slot's ID. + + MUST align with the event's `content.application.type` property as per the + rules for [slots](/client-server-api/#slots). + type: string + type: + enum: + - m.rtc.slot + type: string +title: MatrixRTC slot +type: object