Document TFW message format in README

This commit is contained in:
Kristóf Tóth 2018-04-18 20:41:16 +02:00
parent db1b008fc9
commit 3f36826597

View File

@ -50,6 +50,32 @@ This includes context-dependent hints and the automatic typing of commands to a
Note that our frontend implementation is written in Angular. It is maintained and documented in the `frontend-tutorial-framework` repository. Note that our frontend implementation is written in Angular. It is maintained and documented in the `frontend-tutorial-framework` repository.
### Messaging format
The framework uses JSON messages internally and in exposed APIs as well.
These messages must comply some rules.
Don't worry, we are not too fond of rules around these parts.
The TFW message format:
```json
{
"key: "some identifier used for addressing",
"data":
{
...
JSON object carrying anything, preferably cats
...
},
"trigger": "FSM action"
}
```
- The `key` field is used by TFW for addressing and every message must have one (it can be an empty string though)
- The `data` object can contain anything you might want to send
- The `trigger` key is an optional field that triggers an FSM action with that name from the current state (whatever that might be)
## Where to go next ## Where to go next
Most of the components you need have docstrings included (hang on tight, this is work in progress) refer to them for usage info. Most of the components you need have docstrings included (hang on tight, this is work in progress) refer to them for usage info.