dynamicmqttmosquittobridging

Dynamic bridging with $BRIDGE/new


I followed instructions found here Mosquitto-Dynamic Bridging and here https://github.com/Tifaifai/mosquitto#to-dynamically-createdeleteshow-a-bridge-use about dynamic bridging in MQTT with Mosquitto. The last link is the forked version of Mosquitto, but pull request 653 has been included into the main repo of Mosquitto.

So I tried to create my bridge, first with the Mosquitto configuration file. It is a success.

Then I tried to create the bridge dynamically by sending a message on the topic $BRIDGE/new as explained in the second link.

Here is the content:

connection myBridge
address IP_ADDRESS_OF_DISTANT_MOSQUITTO:1883
topic # both 0
remote_clientid myClientID
remote_username myUsername
remote_password myPassword

In fact, I just copied the content of the configuration file that worked fine.

Success? No.

So a I tried the JSON version of the message:

{
  "bridges": [
    {
      "connection": "myBridge",
      "addresses": [
        {
          "address": "IP_ADDRESS_OF_DISTANT_MOSQUITTO",
          "port": 1883
        }
      ],
      "topic": "#",
      "direction": "both",
      "qos": 0,
      "remote_username": "myUsername",
      "remote_password": "myPassword"
    }
  ]
}

Success? Also no.

I forgot something: I use v2.0.12 and v2.0.14 releases of Mosquitto.

Does someone as any clue to help me found the way of using dynamic bridging?

Thanks


Solution

  • If you look at the latest PR for this (https://github.com/eclipse/mosquitto/pull/1926) you can see that this is targeted at mosquitto v2.1.0 so it has not been merged into the master branch and released yet.

    So it will not work with v2.0.x

    PR 653 was not merged.