mqtt - Is it sensible to version topic strings? -


there seem best practices concerning mqtt topics. laid out on hivemq website (amongst other things):

don’t use leading forward slash
don’t use spaces in topic
keep topic short , concise

an example topic was

myhome/livingroom/temperature

my question: could idea include version level in topic string? example:

v1/myhome/livingroom/sensor/1/temperature v2/myhome/livingroom/sensor/2/temperature 

i thinking little bit of versions in rest apis here. in version 1 send temperature simple string. later have decided want use json format message payload newer sensors.

the receiving clients check version , handle payload accordingly.

if don't need support multiple versions @ once, don't it. if absolutely have to, i'd suggest @ sensor level, not root. gives flexibility on replacing sensors, not others e.g.:

myhome/livingroom/sensor/1/v1/temperature 

or

myhome/livingroom/sensor/1/temperature/v1 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -