We have extended broker-side messages filtration with message field. Message is a JSON object with following keys:
- topic - a topic string
- topics - an array with topic words splited by '/'
- cid - publisher id
- timestamp - message timestamp
- user_properties - an object with list of user properties
- payload - a string with message payload
You can combine message filter with other filters like payload etc. Multiple filters are applied with AND logic.
Example:
We have following topics: temperature/kitchen, temperature/bedroom, temperature/hall. Message payload is a temperature. So we want to receive temperature from kitchen and hall if it is below 20 degrees.
Message filter is: (topics[1]=="kitchen"||topics[1]=="hall")&&tonumber(payload)<20
Subscription with encoded filter is: $filter/message=(topics%5B1%5D%3D%3D%22kitchen%22%7C%7Ctopics%5B1%5D%3D%3D%22hall%22)%26%26tonumber(%22payload%22)%3C20/temperature/+