Search code examples
node.jsibm-cloudmqttnode-redwatson-iot

Is it possible to create an Mqtt-In and Mqtt-out node building only one new node?


I want to merge a mqtt in node and a mqtt out node. Is it this possible?

I think yes, but I'm not so sure.


Solution

  • If you want to bridge 2 brokers (equivalent to MQTT-in node linked to MQTT-out node with different brokers configured in each) then building a node to do this doesn't gain you anything, you still have to configure 2 brokers. The effort of selecting the correct broker in each node and wiring it together is trivial.

    Of course it is perfectly possible to build a Node-RED node to this, but it would be node with no inputs or outputs. The only reason I would do this would be as self education exercise but since it has no input/outputs it wouldn't really teach much that would be transferable to any more normal nodes.

    Also there is no real practical point using Node-RED to bridge 2 brokers anyway, the MQTT spec specifically supports bridging, nearly all brokers allow bridges to be directly configured between them and this also allows for topic remapping at the same time. For details see something like the mosquitto configuration man page here