How to isolate a device in a topic related to its clientid?


#1

We need to isolate the device under its own topic i.e: {clientid}/branch/leaf so the device has access only to its own deviceid topic tree?


#2

Hello,

You have several ways for doing this. In the following link you have several ideas for that:

In essense, you can use Filters [1] to make ensure some devices are the ones that can publish or subscribe. This way you create these device isolated topic tree:

[1] Sending messages to specific MQTT devices

The idea is to create a set of filters like this:

  • Filter for deviceA (or set of devices like A)
  • Filter for deviceB (or set of devices like B)
  • Filter for admin devices (bypass all restrictions)
  • Deny all filter

This way if a device has no match to any filter, will reach last filter (deny all).

Best Regards,


#3

It is possible i.e mosquitto to have a filter with wildcard “clientid” (%c) so you create a topic: “%c/#” so it applies to each device that connects. There are wildcards in myqtthub?


#4

Hello,

We have just published an engine update that allows to configure topic filters using %c and %u replacements,
just like mosquitto, to provide matching to connecting clientId and userName value.

Here you have additional indication:

Best Regards,