I am wondering about best practices of topic naming and payload design of mqtt messages.
Is it better to have multiple and long topic names instead and a bigger payload or short topic name with bigger payload.
For example:
plant1/machineA/sensorX/temperature/value 20
plant1/machineA/sensorX/temperature/unit C
plant1/machineA/sensorX/temperature/timestamp 2018-08-01T12:00:30.123Z
vs.
plant1/machineA/
{
["sensorX": {
"value": 20,
"unit": "C",
"timestamp": "2018-08-01T12:00:30.123Z"
}]
}
There are a lot more possibilities. But is there a general approach? As much as possible in topic name or in payload?