|
| 1 | +MSC4308: Thread Subscriptions extension to Sliding Sync |
| 2 | +=== |
| 3 | + |
| 4 | +## Background and Summary |
| 5 | + |
| 6 | +Threads were introduced in [version 1.4 of the Matrix Specification](https://spec.matrix.org/v1.13/changelog/v1.4/) as a way to isolate conversations in a room, making it easier for users to track specific conversations that they care about (and ignore those that they do not). |
| 7 | + |
| 8 | +Threads Subscriptions are proposed in [MSC4306](https://github.com/matrix-org/matrix-spec-proposals/blob/rei/msc_thread_subscriptions/proposals/4306-thread-subscriptions.md) as a way for users to efficiently indicate which threads they care about, for the purposes of receiving updates. |
| 9 | + |
| 10 | +Sliding Sync is proposed in [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/blob/erikj/sss/proposals/4186-simplified-sliding-sync.md) as a paginated replacement to `/_matrix/client/v3/sync` with smaller response bodies and lower latency. |
| 11 | +The `/_matrix/client/v3/sync` endpoint is notorious in real-world applications of Matrix for producing large response bodies (to the amplified detriment of mobile clients) and the high latency caused by waiting for the server to calculate that full payload. |
| 12 | + |
| 13 | +This MSC proposes an 'extension' to Sliding Sync that allows clients to opt-in to receiving updates to the user's thread subscriptions. |
| 14 | + |
| 15 | +## Proposal |
| 16 | + |
| 17 | +The Sliding Sync request format is extended to include the `thread_subscriptions` extension as follows: |
| 18 | + |
| 19 | +```jsonc |
| 20 | +{ |
| 21 | + // ... |
| 22 | + |
| 23 | + "extensions": { |
| 24 | + // ... |
| 25 | + |
| 26 | + // Used to opt-in to receiving updates to thread subscriptions. |
| 27 | + "thread_subscriptions": { |
| 28 | + // Maximum number of thread subscription changes to receive. |
| 29 | + // Defaults to 100. |
| 30 | + "limit": 100, |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +The response format is then extended to compensate: |
| 37 | + |
| 38 | +```jsonc |
| 39 | +{ |
| 40 | + // ... |
| 41 | + |
| 42 | + "extensions": { |
| 43 | + // ... |
| 44 | + |
| 45 | + // Returns a limited window of updates to thread subscriptions |
| 46 | + "thread_subscriptions": { |
| 47 | + "changed": [ |
| 48 | + { |
| 49 | + "room_id": "!roomid:example.org", |
| 50 | + "root_event_id": "$abc123", |
| 51 | + |
| 52 | + "subscribed": true, |
| 53 | + |
| 54 | + // must be present when subscribed is true, |
| 55 | + // but must be absent when subscribed is false |
| 56 | + "automatic": true |
| 57 | + }, |
| 58 | + { |
| 59 | + "room_id": "!roomid:example.org", |
| 60 | + "root_event_id": "$def456", |
| 61 | + |
| 62 | + "subscribed": false |
| 63 | + }, |
| 64 | + ... |
| 65 | + ] |
| 66 | + } |
| 67 | + } |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +## Potential issues |
| 72 | + |
| 73 | +When clients start a fresh sync with no initial state, it may be the case that there is a backlog of many thread_subscriptions to send down to the client. |
| 74 | + |
| 75 | +Servers MAY choose to return Thread Subscription Settings in an order that is more heuristically-useful to the client, such as 'most recently updated' or 'threads with most recent activity first', instead of 'oldest first'. This could be either for all Thread Subscriptions, or only the backlogged ones. |
| 76 | + |
| 77 | +## Alternatives |
| 78 | + |
| 79 | + |
| 80 | +## Limitations |
| 81 | + |
| 82 | + |
| 83 | +## Security considerations |
| 84 | + |
| 85 | +- No particular security issues anticipated. |
| 86 | + |
| 87 | +## Unstable prefix |
| 88 | + |
| 89 | +TODO |
| 90 | + |
| 91 | +## Dependencies |
| 92 | + |
| 93 | +- [MSC4186 Sliding Sync](https://github.com/matrix-org/matrix-spec-proposals/blob/erikj/sss/proposals/4186-simplified-sliding-sync.md) |
| 94 | +- [MSC4306 Threads Subscriptions](https://github.com/matrix-org/matrix-spec-proposals/blob/rei/msc_thread_subscriptions/proposals/4306-thread-subscriptions.md) |
0 commit comments