Multiple MQTT topics or single with switch?

Hi all!
For efficiency is it better to have a single MQTT input node that receives all the topics and then add a switch to divide the topics or is it better to have multiple MQTT input node one for every topic?
Thanks!

Unless you have 1000's of topics to deal with, this is mostly a convenience thing. Every single mqtt node becomes a connection to the mqtt server as a publish/subscription. Mosquitto can handle easily 100k connections on light hardware.

However, you can also easily combine similar topics by using wildcards. Depending on your setup. You can read about best practices here.

No need to worry about any efficiency gains in the context of node-red I believe.

1 Like

Yes. Either you split it with a switch node or the mqtt node “splits” it for you. So it’s going to be magical either way. Do whichever suits your layout/understanding better especially when you come back to it in 6 months time.

3 Likes

:mage: @dceejay The wizard has spoken :magic_wand:

DCJ edit —- Good old autocorrect. Should have read “marginal “

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.