Updated Intent and scope (markdown)

ni-richard 2019-09-17 00:39:36 +02:00
parent d9d8201b30
commit a4d749d465
2 changed files with 10 additions and 1 deletions

@ -1 +0,0 @@
Empty.

10
Key,-intent-and-scope.md Normal file

@ -0,0 +1,10 @@
TFW messages have these three essential properties that are described below. You have to add these to the *JSON object* either explicitly, or implicitly by calling the `send_message` method on a server connector. In case of the latter, you only have to provide the key, the default values for the *intent* property is `"control"` and `"zmq"` for *scope*.
### Key
It indicates the domain of the message along with a command like `message.send`. You can define your own ones and send it to the TFW server, but nothing will happen until you create an event handler, which listens to that exact key.
### Intent
This property has to accepted values: `"control"` and `"event"`. The former used to instruct an event handler to perform an action and the latter emits information about something's state. This distinction is really important, because the lack of intent could lead to infinite recursion in event handlers.
### Scope
This one specifies the direction of the message: `"zmq"`, `"websocket"`, `"broadcast"`. Their names are quite talkative, the first one forwards the message to the event handlers, the second one goes to the frontend and the third one is send to both directions.