Message format

In order to support synchronous (blocking) messages with MQTT -which doesn’t inherently provide this capability- there needs to be a way to match new messages (Responses) to previous ones (Requests). To that end a very simple message wrapper is introduced:

public class MqttMsg
    {
        public eMsgFlags Flags;
        public int SyncId;
        public string Payload;
    }

For example, the following NodeInfoRsp message:

Text

{
    "Name":"node",
    "Type":2,
    "Capabilities":0,
    "ThingTypes":null,
    "ThingsRevNum":4,
    "SupportedApiRev":1,
    "BlockLibraries":null
}

that is a response to a NodeInfoReq message with SyncId=34 should be sent as:

Text

{
  "SyncId": 34,
  "Flags":2,
  "Payload": "{\"Name\":\"node\",\"Type\":2,\"Capabilities\":0,\"ThingTypes\":null,\"ThingsRevNum\":4,\"SupportedApiRev\":1,\"BlockLibraries\":null}"
}