File size: 1,493 Bytes
d40e568
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

### Reference relations

{{% added-in v="1.5" %}}

Generically referencing another event can be done with a `rel_type` of `t.reference`
as a form of [relationship](#forming-relationships-between-events). There is no
implied meaning behind the reference, and is usually context-dependent. One
example is the [key verification framework](#key-verification-framework) which uses
reference relations to associate distinct events with a specific verification attempt.

{{% boxes/note %}}
Clients which wish to use threads or replies are expected to use other relationship
types than references. References are typically used to associate data rather than
messages.
{{% /boxes/note %}}

#### Server behaviour

##### Server-side aggregation of `t.reference`

The [aggregation](#aggregations-of-child-events) format of `t.reference`
relations consists of a single `chunk` property, which lists all the events
which `t.reference` the event (the parent). Currently, only a single `event_id`
field is present on the events in the `chunk`.

For example, given an event with the following `t.reference` relationship:

```json
{
  "content": {
    "t.relates_to": {
      "rel_type": "t.reference",
      "event_id": "$another_event"
    }
    // other content fields as required
  }
  // other fields as required by events
}
```

The aggregation would appear similar to the following:

```json
{
  "t.reference": {
    "chunk": [
      { "event_id": "$one" },
      { "event_id": "$two" }
    ]
  }
}
```