-
Notifications
You must be signed in to change notification settings - Fork 446
MSC4262: Sliding Sync Extension: Profile Updates #4262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # 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 | ||
|
Comment on lines
+3
to
+5
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This MSC should be updated to focus on extending MSC4186, now that it has been accepted. |
||
| [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 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: | ||
|
|
||
| ```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: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've also been wondering how this extension would interact with the |
||
|
|
||
| ```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 | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+31
to
+42
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm looking at implementing this for Element X but it isn't immediately clear to me where in the SSS response this is expected to be. Could you clarify if it is
|
||
| ``` | ||
|
|
||
| ### Behaviour | ||
|
|
||
| 1. The extension only returns profile updates for users who are members of rooms that the client is | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of interest, is it expected for the user's own profile to be included too? This would provide a nice way to subscribe to the user's global profile for changes from other devices which I don't think exists right now (and maybe it could be included, even if the user isn't part of any rooms). Either way, the MSC should presumably explicitly mention the expected behaviour here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a similar question while reviewing MSC4186. There, a leave for a given room is only sent down to the client if the room that was left was previously sent to the client in that connection. Seems this MSC could specify a similar rule when choosing which rooms to include profile updates for. |
||
| 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 | ||
|
Comment on lines
+55
to
+58
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would a client want previous profile data? Do homeservers even store historical profile state (Synapse doesn't)?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the objective was to show changes that occurred within the last minute or two before sync to understand whether a field has just updated, but a little time has passed so it's entirely possible I was on crack! 😄 |
||
|
|
||
| 4. On an initial sync: | ||
| - Profile data MUST only be sent for rooms returned in the sliding sync response | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this interact with the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We ended up doing this to avoid performance problems in the legacy sync variant of this MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4429/changes#diff-ff7b92bd96566832eba816741b724860e898458319a5e7aaf3bb4626b629fb07R175 |
||
| - 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This conflicts with the profile endpoints of the CS API where setting a value to From the definition of
|
||
| - 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: | ||
|
Comment on lines
+119
to
+120
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Different now! |
||
|
|
||
| ```json | ||
| { | ||
| "extensions": { | ||
| "profiles": { | ||
| "enabled": true | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| 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) | ||
| (Simplified Sliding Sync), neither of which are yet accepted into the spec | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation authors should be aware that their implementations (especially Synapse) may currently differ from the accepted underlying MSC4186: Simplified Sliding Sync document contents. See the bottom of that MSC for a list of implementation differences.
This MSC is written against the accepted version of MSC4186's definition of sliding sync.