From 3f36826597440689800398094150125e010548dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 18 Apr 2018 20:41:16 +0200 Subject: [PATCH] Document TFW message format in README --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 1f23bb6..94d8a7f 100644 --- a/README.md +++ b/README.md @@ -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. +### 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 Most of the components you need have docstrings included (hang on tight, this is work in progress) – refer to them for usage info.