freechat/docs/content/rtc/structure.md
shockrah aed1737782 + Docs for badge rtc events
Describes what kind of data to expect from RTC events

+ Meta docs around conventions in badge docs section
2021-06-14 21:38:56 -07:00

38 lines
690 B
Markdown

---
title: Event Structure
anchor: event-structure
weight: 42
---
There are a few rules regarding RTC event data structures:
1. They are always JSON encoded
2. Top level keys are for either meta data or a root node which leads to actual event data
Top level fields are as follows:
* type: string
Denotes the event type as a string. This value is used as a key to identify the
actual event data itself.
* \<type\>: \<data\>
The key here is found by checking the value associated with "type".
Behind this event data can be found; for example a `new-message` event payload
would look like:
```
{
"type": "new-message",
"new-message": {
"id": 123,
"time: 1623730090
}
}
```