The event is the former message, but way more flexible, allowing us to use it for different goals. Currently, we only use it for messages and some room events.

Interface Definition

interface IEvent<T extends EDataDefinition> {
_id: string;
clid?: string;
pids: Array<string>;
v: number;
ts: Date;
src: string;
ct: EventContext;
cid: string;
t: EventTypeDescriptor;
dHash: string;
o: T;
d: T;
isLeaf?: boolean;
deletedAt?: Date;




The event id, which is a SHA256 hash of the src, ct, cid, _pids, t, ts and dHash


This is the "id generated by the client", on V1 our clients generate the _id of the message, so this needs to be here for backward compatibility


The ids of the previous events


The version of the schema


The source of this event, which server, this will be used to federate events later on


This is part of the context, holds the type of the context (for example, "room"), more in EventContext


This is also part of the context, holds the of the context (like the room id)


The type of the event, details in EventTypeDescriptor


The hash of some or all of the properties on d, depending on the event type


The event's data when it was created, this never changes and it is used to calcute the hash when a integrity verification is realized


The event's data, the payload, details in EventDataDefinition, this can change when and event is updated using IEventDataUpdate


This will on appear when it is set to true and determines wheter or not this is the latest item of a chain, the leaf of the tree. More than one event may have the isLeaf flagged as true in the same context


The date that this event was deleted

Example of types "room" and "msg":

room_events: [
"_id": "8aa776ae767c37254c6a85f914a6151d3bb558ff0a9d639f13f0fe5f11af92db",
"pids": [],
"v": 2,
"ts": ISODate("2020-06-11T19:46:40.192Z"),
"src": "",
"ct": "room",
"cid": "a7c5MQFQGe4XKMyEo",
"t": "room",
"dHash": "469d7080b26464d8e684dc72c409dd669676ff0e6bbdd4b6f3392c4cb1fd780d",
"o": {
"d": {
"_id": "f53baadb1090c2b4f9d445d030902e142065b5e177a50799c2cc6b1d2a75800e",
"clid": "D2Hznvc4jt7YRSaQy",
"pids": [
"v": 2,
"ts": ISODate("2020-06-11T19:46:42.385Z"),
"src": "localhost",
"ct": "room",
"cid": "a7c5MQFQGe4XKMyEo",
"t": "msg",
"dHash": "793dd0f58f7f9b243ecb35fed189260633058e0ee1468813148b4e8b33567a2e",
"o": {
"d": {
Edit on GitHub