From c02657ecaab9b1e9a0b8ee9ccd75ccd1c52a6b2f Mon Sep 17 00:00:00 2001 From: Tom Foster Date: Mon, 3 Feb 2025 13:14:30 +0000 Subject: [PATCH 1/4] MSC4262 initial commit --- proposals/4262-sliding-sync-profiles.md | 121 ++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 proposals/4262-sliding-sync-profiles.md diff --git a/proposals/4262-sliding-sync-profiles.md b/proposals/4262-sliding-sync-profiles.md new file mode 100644 index 0000000000..056b489e2b --- /dev/null +++ b/proposals/4262-sliding-sync-profiles.md @@ -0,0 +1,121 @@ +# MSC4262: Sliding Sync Extension: Profile Updates + +This MSC is an extension to [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) which adds support for receiving profile updates via Sliding Sync. It complements [MSC4259](https://github.com/matrix-org/matrix-spec-proposals/pull/4259) which handles federation-level profile updates. + +## Proposal + +MSC3575 currently does not include support for receiving profile field updates through the `/sync` endpoint. This extension adds support for receiving profile updates for users who are members of rooms the client is subscribed to. + +The proposal introduces a new extension called `profiles`. It processes the core extension arguments `enabled`, `rooms`, and `lists`, and adds the following optional arguments: + +```json5 +{ + "enabled": true, // sticky + "lists": ["rooms", "dms"], // sticky + "rooms": ["!abcd:example.com"], // sticky + "fields": ["displayname", "avatar_url"], // optional filter for specific profile fields + "include_history": false // optional, defaults to false +} +``` + +If `enabled` is `true`, then the sliding sync response MAY include profile updates in the following format: + +```json5 +{ + "users": { + "@alice:example.com": { + "displayname": "Alice", + "avatar_url": "mxc://example.com/abc123", + "org.example.language": "en-GB" + }, + "@bob:example.com": { + "displayname": null // Field removal + } + } +} +``` + +### Behaviour + +1. The extension only returns profile updates for users who are members of rooms that the client is subscribed to via either: + - Room IDs explicitly listed in the `rooms` argument + - Rooms that fall within the sliding windows specified in `lists` + +2. The optional `fields` argument allows clients to filter which profile fields they want to receive updates for. If omitted, all profile field updates are included. + +3. The optional `include_history` argument controls whether the initial sync includes recent historical profile changes: + - If false (default), only current profile states are sent on initial sync + - If true, the server MAY include recent profile changes that occurred before the sync + +4. On an initial sync: + - Profile data MUST only be sent for rooms returned in the sliding sync response + - If `include_history` is false, only current profile states are sent + - If `include_history` is true, recent profile changes MAY be included + +5. When live streaming: + - Profile updates MUST be sent as the server receives them + - For rooms which initially appear (`initial: true`) due to direct subscriptions or rooms moving into the sliding window, current profile states MUST be included + - A null value for a field indicates the field has been removed + - Omitted fields should be considered unchanged + +### Implementation Notes + +- Servers SHOULD implement appropriate batching and rate limiting of profile updates to prevent overwhelming clients + +- While this extension provides real-time profile updates, implementations should note: + - Network issues could cause missed updates + - Clients MAY implement periodic full profile refreshes if they require stronger consistency guarantees + - The frequency of such refreshes should be balanced against resources and desired freshness + +- Profile updates are typically infrequent compared to other real-time events like typing notifications, so including them in sliding sync is considered efficient + +## Potential Issues + +1. Large Initial Sync Payload + - With `include_history` enabled, the initial sync could be large for rooms with many members + - Servers should consider implementing reasonable limits on historical profile data + +2. Update Frequency + - Some users might update profiles frequently + - Implementations should consider rate limiting and batching updates + +## Alternatives + +1. Separate Profile Sync API + - Could provide more granular control over profile syncing + - Would increase complexity by requiring another connection + - Would duplicate much of sliding sync's room subscription logic + +2. Push-based Profile Updates + - Could use a separate WebSocket connection for profile updates + - Would increase complexity and connection overhead + - Would duplicate room subscription logic + +## Security Considerations + +1. Profile information is considered public data in Matrix + +2. The extension respects existing privacy boundaries: + - Only returns updates for users in rooms the client can access + - Follows the same authentication and authorization as the main sliding sync endpoint + +3. Rate limiting helps prevent abuse + +## Unstable Prefix + +No unstable prefix as Sliding Sync is still in review. To enable this extension, add this to your request JSON: + +```json +{ + "extensions": { + "profiles": { + "enabled": true + } + } +} +``` + +## Dependencies + +This MSC builds on: +- MSC3575 (Sliding Sync), which is not yet accepted into the spec From b1edd39044a133f79cfb08d9c9b6a79ae2ddae32 Mon Sep 17 00:00:00 2001 From: Tom Foster Date: Mon, 3 Feb 2025 13:23:47 +0000 Subject: [PATCH 2/4] Correct line wrapping --- proposals/4262-sliding-sync-profiles.md | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/proposals/4262-sliding-sync-profiles.md b/proposals/4262-sliding-sync-profiles.md index 056b489e2b..74345f9d6a 100644 --- a/proposals/4262-sliding-sync-profiles.md +++ b/proposals/4262-sliding-sync-profiles.md @@ -1,12 +1,18 @@ # MSC4262: Sliding Sync Extension: Profile Updates -This MSC is an extension to [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) which adds support for receiving profile updates via Sliding Sync. It complements [MSC4259](https://github.com/matrix-org/matrix-spec-proposals/pull/4259) which handles federation-level profile updates. +This MSC is an extension to [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) +which adds support for receiving profile updates via Sliding Sync. It complements +[MSC4259](https://github.com/matrix-org/matrix-spec-proposals/pull/4259) which handles +federation-level profile updates. ## Proposal -MSC3575 currently does not include support for receiving profile field updates through the `/sync` endpoint. This extension adds support for receiving profile updates for users who are members of rooms the client is subscribed to. +MSC3575 currently does not include support for receiving global profile field updates through the +`/sync` endpoint. This extension adds support for receiving profile updates for users who are +members of rooms the client is subscribed to. -The proposal introduces a new extension called `profiles`. It processes the core extension arguments `enabled`, `rooms`, and `lists`, and adds the following optional arguments: +The proposal introduces a new extension called `profiles`. It processes the core extension +arguments `enabled`, `rooms`, and `lists`, and adds the following optional arguments: ```json5 { @@ -37,13 +43,16 @@ If `enabled` is `true`, then the sliding sync response MAY include profile updat ### Behaviour -1. The extension only returns profile updates for users who are members of rooms that the client is subscribed to via either: +1. The extension only returns profile updates for users who are members of rooms that the client is + subscribed to via either: - Room IDs explicitly listed in the `rooms` argument - Rooms that fall within the sliding windows specified in `lists` -2. The optional `fields` argument allows clients to filter which profile fields they want to receive updates for. If omitted, all profile field updates are included. +2. The optional `fields` argument allows clients to filter which profile fields they want to receive + updates for. If omitted, all profile field updates are included. -3. The optional `include_history` argument controls whether the initial sync includes recent historical profile changes: +3. The optional `include_history` argument controls whether the initial sync includes recent + historical profile changes: - If false (default), only current profile states are sent on initial sync - If true, the server MAY include recent profile changes that occurred before the sync @@ -54,20 +63,23 @@ If `enabled` is `true`, then the sliding sync response MAY include profile updat 5. When live streaming: - Profile updates MUST be sent as the server receives them - - For rooms which initially appear (`initial: true`) due to direct subscriptions or rooms moving into the sliding window, current profile states MUST be included + - For rooms which initially appear (`initial: true`) due to direct subscriptions or rooms moving + into the sliding window, current profile states MUST be included - A null value for a field indicates the field has been removed - Omitted fields should be considered unchanged ### Implementation Notes -- Servers SHOULD implement appropriate batching and rate limiting of profile updates to prevent overwhelming clients +- Servers SHOULD implement appropriate batching and rate limiting of profile updates to prevent + overwhelming clients - While this extension provides real-time profile updates, implementations should note: - Network issues could cause missed updates - Clients MAY implement periodic full profile refreshes if they require stronger consistency guarantees - The frequency of such refreshes should be balanced against resources and desired freshness -- Profile updates are typically infrequent compared to other real-time events like typing notifications, so including them in sliding sync is considered efficient +- Profile updates are typically infrequent compared to other real-time events like typing + notifications, so including them in sliding sync is considered efficient ## Potential Issues @@ -103,7 +115,8 @@ If `enabled` is `true`, then the sliding sync response MAY include profile updat ## Unstable Prefix -No unstable prefix as Sliding Sync is still in review. To enable this extension, add this to your request JSON: +No unstable prefix as Sliding Sync is still in review. To enable this extension, add this to your +request JSON: ```json { @@ -118,4 +131,5 @@ No unstable prefix as Sliding Sync is still in review. To enable this extension, ## Dependencies This MSC builds on: + - MSC3575 (Sliding Sync), which is not yet accepted into the spec From cd8654fb00e1608149519004a94616fe7c73e4be Mon Sep 17 00:00:00 2001 From: Tom Foster Date: Mon, 3 Feb 2025 13:28:48 +0000 Subject: [PATCH 3/4] Reference MSC4186 --- proposals/4262-sliding-sync-profiles.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proposals/4262-sliding-sync-profiles.md b/proposals/4262-sliding-sync-profiles.md index 74345f9d6a..efb2e89576 100644 --- a/proposals/4262-sliding-sync-profiles.md +++ b/proposals/4262-sliding-sync-profiles.md @@ -1,6 +1,7 @@ # MSC4262: Sliding Sync Extension: Profile Updates This MSC is an extension to [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) +(and its proposed successor [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/pull/4186)) which adds support for receiving profile updates via Sliding Sync. It complements [MSC4259](https://github.com/matrix-org/matrix-spec-proposals/pull/4259) which handles federation-level profile updates. @@ -132,4 +133,6 @@ request JSON: This MSC builds on: -- MSC3575 (Sliding Sync), which is not yet accepted into the spec +- [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) (Sliding Sync) or its + proposed successor [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/pull/4186) + (Simplified Sliding Sync), neither of which are yet accepted into the spec From cdf2d4729e391fb8c7e9ecfde04c2e31e2993c3d Mon Sep 17 00:00:00 2001 From: Tom Foster Date: Mon, 3 Feb 2025 13:30:58 +0000 Subject: [PATCH 4/4] Unwanted space characters --- proposals/4262-sliding-sync-profiles.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/4262-sliding-sync-profiles.md b/proposals/4262-sliding-sync-profiles.md index efb2e89576..8b0f254a57 100644 --- a/proposals/4262-sliding-sync-profiles.md +++ b/proposals/4262-sliding-sync-profiles.md @@ -134,5 +134,5 @@ request JSON: This MSC builds on: - [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) (Sliding Sync) or its - proposed successor [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/pull/4186) + proposed successor [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/pull/4186) (Simplified Sliding Sync), neither of which are yet accepted into the spec