matrix-spec/content/client-server-api/modules/reference_relations.md
Travis Ralston 9dee6d9233
Apply suggestions from code review
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-08-24 17:21:12 -06:00

1.4 KiB

type
module

Reference relations

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

Generically referencing another event can be done with a rel_type of m.reference as a form of relationship. There is no implied meaning behind the reference, and is usually context-dependent. Such an example is the key verification framework which uses reference relations to associate distinct events with a specific verification attempt.

The aggregation format of m.reference relations consists of a single chunk property to indicate all the events which m.reference the event (the parent). Currently, only a single event_id field is present on the events in the chunk.

{{% 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 %}}

An example m.reference would be:

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

The bundle under m.relations would appear similar to the following:

{
  "m.reference": {
    "chunk": [
      { "event_id": "$one" },
      { "event_id": "$two" }
    ]
  }
}