diff --git a/lib/tfw/networking/serialization.py b/lib/tfw/networking/serialization.py index 5c84a5c..d95537c 100644 --- a/lib/tfw/networking/serialization.py +++ b/lib/tfw/networking/serialization.py @@ -1,5 +1,25 @@ # Copyright (C) 2018 Avatao.com Innovative Learning Kft. # All Rights Reserved. See LICENSE file for details. +""" +TFW JSON message format + +message: +{ + "key": string, # addressing + "data": {...}, # payload + "trigger": string # FSM trigger +} + +ZeroMQ's sub-pub sockets use enveloped messages +(http://zguide.zeromq.org/page:all#Pub-Sub-Message-Envelopes) +and TFW also uses them internally. This means that on ZMQ sockets +we always send the messages key separatley and then the actual +message (which contains the key as well) like so: + +socket.send_multipart([message['key'], message]) + +The purpose of this module is abstracting away this low level behaviour. +""" import json