Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions proposals/4262-sliding-sync-profiles.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client
  • Server

Copy link
Copy Markdown
Member

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.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also been wondering how this extension would interact with the heroes portion of the sync response too. Would the idea be that the client keeps track of these global profiles and automatically merges the new fields (i.e. everything but avatar/name) with each room's heroes?


```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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

  • as shown here and becomes a new top-level object.
  • nested within the extensions object (it seems slightly odd that the extension would be called profiles but the object returned is then called users).
  • adding the custom profile fields to an existing users e.g. if there is such a thing within rooms.

```

### Behaviour

1. The extension only returns profile updates for users who are members of rooms that the client is

@pixlwave pixlwave May 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

@pixlwave pixlwave May 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this interact with the lazy_members flag? Presumably it should only return the profile data for members that have been included in the rooms response too, otherwise the initial sync could be massive if it includes e.g. matrix-hq?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 null doesn't remove the profile field, and might be an acceptable value since extended profiles were merged into the spec.

From the definition of PUT /profile/{userId}/{keyName}:

Servers MAY reject null values. Servers that accept null values SHOULD store them rather than treating null as a deletion request. Clients that want to delete a field, including its key and value, SHOULD use the DELETE endpoint instead.

- 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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