From fc52021bcfa0e712cbaef0c7fdaf297684bb3e02 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 30 Jan 2023 12:44:23 +0000 Subject: [PATCH 1/4] Add receipts extension --- proposals/3960-sliding-sync-receipts.md | 80 +++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 proposals/3960-sliding-sync-receipts.md diff --git a/proposals/3960-sliding-sync-receipts.md b/proposals/3960-sliding-sync-receipts.md new file mode 100644 index 00000000000..c7dcb2bb091 --- /dev/null +++ b/proposals/3960-sliding-sync-receipts.md @@ -0,0 +1,80 @@ +# MSC3960: Sliding Sync Extension: Receipts + +This MSC is an extension to [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) +which includes support for room receipts in the `/sync` response. + +## Proposal + +MSC3575 does not include support for receipts. This extension will add support for both public +and private room receipts. + +The prosposal is to introduce a new extension called `receipts` with the following request parameters: +```js +{ + "enabled": true, // sticky +} +``` +If `enabled` is `true`, then the sliding sync response MAY include the following response fields in +the `receipts` extension response: +```json +{ + "rooms": { + "!foo:bar": { + m.receipt EDU + }, + "!foo2:bar" { + m.receipt EDU + } + } +} +``` + +The `m.receipt` event in this response is the same event that would appear in the array +`rooms.join["!foo:bar"].ephemeral.events` under `/sync`. This includes the `m.read.private` key in the +receipt EDU for private read receipts. + +Receipts MUST only be sent for rooms returned in the sliding sync response. Receipts MUST only be +returned for events sent in the `timeline` section for each room of the sliding sync response. Delta +tokens MUST be ignored when calculating the events in the `timeline`, or else additional read receipts +for the same event would never be returned to the client. The receipts themeselves MAY be subject to +delta tokens such that only read receipt deltas are returned to the client. + +Overall, these steps prevent the sliding sync response from scaling with the amount of rooms on the client. +This contrasts with the existing `/sync` mechanism which sends all receipts for all users in all rooms. + + +## Potential issues + +By not sending receipts for events not in the returned `timeline`, the client will not have receipt +information for old events (e.g retrieved via `/messages`). An additional MSC would be required to add +receipt information to events returned from `/messages`. It is unacceptable to return receipts not in +the returned `timeline` because this can be extremely large e.g for Matrix HQ this is 50,000+ read receipts +just for that room, for events that the client will potentially never view! + +## Alternatives + +This extension could be bundled into the core MSC3575, but this would force all clients to receive this +data. In practice clients can function extremely well without the need for read receipts, so forcing all +clients to receive this data feels like the wrong design. + +## Security considerations + +No additional security considerations beyond what the current `/sync` implementation provides. + +## Unstable prefix + +No unstable prefix as Sliding Sync is still in review. To enable this extension, just add this to +your request JSON: +```js +{ + "extensions": { + "receipts": { + "enabled": true + } + } +} +``` + +## Dependencies + +This MSC builds on MSC3575, which at the time of writing has not yet been accepted into the spec. From 203b4dee074e492fb2e95f9f18d0c96a727ca1ba Mon Sep 17 00:00:00 2001 From: kegsay Date: Mon, 30 Jan 2023 12:48:26 +0000 Subject: [PATCH 2/4] Update 3960-sliding-sync-receipts.md --- proposals/3960-sliding-sync-receipts.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proposals/3960-sliding-sync-receipts.md b/proposals/3960-sliding-sync-receipts.md index c7dcb2bb091..5748bfb1cc4 100644 --- a/proposals/3960-sliding-sync-receipts.md +++ b/proposals/3960-sliding-sync-receipts.md @@ -33,9 +33,10 @@ The `m.receipt` event in this response is the same event that would appear in th `rooms.join["!foo:bar"].ephemeral.events` under `/sync`. This includes the `m.read.private` key in the receipt EDU for private read receipts. -Receipts MUST only be sent for rooms returned in the sliding sync response. Receipts MUST only be -returned for events sent in the `timeline` section for each room of the sliding sync response. Delta -tokens MUST be ignored when calculating the events in the `timeline`, or else additional read receipts +Receipts MUST only be sent for rooms returned in the sliding sync response. Receipts MUST be +returned for events sent in the `timeline` section for each room of the sliding sync response. In addition, +public and private receipts sent by the client MUST be returned, even if the events in question are not in the `timeline`. +Delta tokens MUST be ignored when calculating the events in the `timeline`, or else additional read receipts for the same event would never be returned to the client. The receipts themeselves MAY be subject to delta tokens such that only read receipt deltas are returned to the client. From e6404b6c0fd34797c35a0e967ef688503b23a91f Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 3 Apr 2023 15:52:52 +0100 Subject: [PATCH 3/4] List- and room- scoping --- proposals/3960-sliding-sync-receipts.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/proposals/3960-sliding-sync-receipts.md b/proposals/3960-sliding-sync-receipts.md index 5748bfb1cc4..d33017e0f79 100644 --- a/proposals/3960-sliding-sync-receipts.md +++ b/proposals/3960-sliding-sync-receipts.md @@ -8,27 +8,36 @@ which includes support for room receipts in the `/sync` response. MSC3575 does not include support for receipts. This extension will add support for both public and private room receipts. -The prosposal is to introduce a new extension called `receipts` with the following request parameters: -```js +The proposal is to introduce a new extension called `receipts`. It processes the +core extension arguments `enabled`, `rooms` and `lists`, but defines no +arguments of its own. +```json5 { "enabled": true, // sticky + "lists": ["rooms", "dms"], // sticky + "rooms": ["!abcd:example.com"] // sticky } ``` If `enabled` is `true`, then the sliding sync response MAY include the following response fields in the `receipts` extension response: -```json +```json5 { "rooms": { "!foo:bar": { - m.receipt EDU + // m.receipt EDU }, - "!foo2:bar" { - m.receipt EDU + "!foo2:bar": { + // m.receipt EDU } } } ``` +If a `lists` or `rooms` argument is given to the extension, the `typing` extension +response SHOULD only include rooms belonging at least one of the sliding windows +in `lists`, or rooms whose IDs are in `rooms`. See also MSC3575's "Extensions" +section. + The `m.receipt` event in this response is the same event that would appear in the array `rooms.join["!foo:bar"].ephemeral.events` under `/sync`. This includes the `m.read.private` key in the receipt EDU for private read receipts. @@ -66,7 +75,7 @@ No additional security considerations beyond what the current `/sync` implementa No unstable prefix as Sliding Sync is still in review. To enable this extension, just add this to your request JSON: -```js +```json { "extensions": { "receipts": { From 7fd44588cc6be37ef7df6631ec05d76232ace761 Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Tue, 6 Aug 2024 09:42:35 +0100 Subject: [PATCH 4/4] Update proposals/3960-sliding-sync-receipts.md Co-authored-by: Eric Eastwood --- proposals/3960-sliding-sync-receipts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/3960-sliding-sync-receipts.md b/proposals/3960-sliding-sync-receipts.md index d33017e0f79..5de7f3d31cd 100644 --- a/proposals/3960-sliding-sync-receipts.md +++ b/proposals/3960-sliding-sync-receipts.md @@ -42,7 +42,7 @@ The `m.receipt` event in this response is the same event that would appear in th `rooms.join["!foo:bar"].ephemeral.events` under `/sync`. This includes the `m.read.private` key in the receipt EDU for private read receipts. -Receipts MUST only be sent for rooms returned in the sliding sync response. Receipts MUST be +Receipts MUST only be sent for rooms returned in the sliding sync response. On initial sync, receipts MUST only be returned for events sent in the `timeline` section for each room of the sliding sync response. In addition, public and private receipts sent by the client MUST be returned, even if the events in question are not in the `timeline`. Delta tokens MUST be ignored when calculating the events in the `timeline`, or else additional read receipts