Skip to content

Commit 21dc6f8

Browse files
authored
Merge pull request #1484 from turt2live/travis/s2s/read-receipts
Document how read receipts work over federation
2 parents 8ac6cea + c492fe4 commit 21dc6f8

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright 2018 New Vector Ltd
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
type: object
16+
title: Receipt EDU
17+
description: |-
18+
An EDU representing receipt updates for users of the sending homeserver.
19+
When receiving receipts, the server should only update entries that are
20+
listed in the EDU. Receipts previously received that do not appear in the
21+
EDU should not be removed or otherwise manipulated.
22+
allOf:
23+
- $ref: ../edu.yaml
24+
- type: object
25+
properties:
26+
edu_type:
27+
type: enum
28+
enum: ['m.receipt']
29+
description: The string ``m.receipt``
30+
example: "m.receipt"
31+
content:
32+
type: object
33+
description: |-
34+
Receipts for a particular room. The string key is the room ID for
35+
which the receipts under it belong.
36+
additionalProperties:
37+
type: object
38+
title: Room Receipts
39+
properties:
40+
# We strongly define the receipt type to help spec future ones later
41+
# on. At that point, m.read can become optional (maybe).
42+
"m.read":
43+
type: object
44+
description: Read receipts for users in the room.
45+
title: User Read Receipt
46+
properties:
47+
event_ids:
48+
type: array
49+
description: |-
50+
The extremity event IDs that the user has read up to.
51+
minItems: 1
52+
maxItems: 1
53+
items:
54+
type: string
55+
example: ['$read_this_event:matrix.org']
56+
data:
57+
type: object
58+
description: Metadata for the read receipt.
59+
title: Read Receipt Metadata
60+
properties:
61+
ts:
62+
type: integer
63+
format: int64
64+
description: |-
65+
A POSIX timestamp in milliseconds for when the user read
66+
the event specified in the read receipt.
67+
example: 1533358089009
68+
required: ['ts']
69+
required: ['event_ids', 'data']
70+
required: ['m.read']
71+
example: {
72+
"!some_room:domain.com": {
73+
"m.read": {
74+
"@john:matrix.org": {
75+
"event_ids": ["$read_this_event:matrix.org"],
76+
"data": {
77+
"ts": 1533358089009
78+
}
79+
}
80+
}
81+
}
82+
}

specification/server_server_api.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,18 @@ Rejecting a presence invite::
885885
- Explain the zero-byte presence inference logic
886886
See also: docs/client-server/model/presence
887887
888+
Receipts
889+
--------
890+
891+
Receipts are EDUs used to communicate a marker for a given event. Currently the
892+
only kind of receipt supported is a "read receipt", or where in the event graph
893+
the user has read up to.
894+
895+
Read receipts for events events that a user sent do not need to be sent. It is
896+
implied that by sending the event the user has read up to the event.
897+
898+
{{definition_ss_event_schemas_m_receipt}}
899+
888900
Querying for information
889901
------------------------
890902

0 commit comments

Comments
 (0)