-
Notifications
You must be signed in to change notification settings - Fork 389
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
MSC4262: Sliding Sync Extension: Profile Updates #4262
Open
tcpipuk
wants to merge
4
commits into
matrix-org:main
Choose a base branch
from
tcpipuk:patch-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
[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: | ||
|
||
```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](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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: