MQTT Node connections

Hi ,

I am using MQTT node to publish and subscribe on different topics (all the same flow) to mosquitto broker.
everything work very well, I can send command to the node-red in raspberry pi3 and publish data from sensor to the broker.
but I monitor the traffic in wireshark, I have found that MQTT publish and subscriber in the same TCP Channel, when I checked the conversation statistic in wireshark it is only one connection with two way, that means, it has only the following two connections:
raspberry pi IP to Mosquitto IP
mosquitto IP to raspberry pi

only these two, and the packet counts and size are increasing all the time.

my question, can we make mqtt over multiple TCP connections?

Hi @manal

In the MQTT nodes there is the drop-down list of brokers you pick from. They represent the individual connections the nodes will make. So if two nodes use the same broker from the list, they will share a connection.

If you want two nodes to use different connections, you can add additional brokers to the drop-down - even if they ultimately point at the same physical broker.

Thanks a lot
it is working

I appear to be having a similar issue... I've added 2 MQTT broker configurations. When I added the 2nd config, my 1st one stopped working. I've confirmed that each of the broker nodes is correctly pointing to the right broker config.

Config:
#1 -- points to TeslaMate mosquito
#2 --- points to a publicly accessible Mosquito broker I setup

#1 used to work, but now that I added #2 it only shows "connecting" status....

Any suggestions would be welcome!

Screen Shot 2022-09-07 at 3.25.50 PM

Welcome to the forum @aaroneden

Please select one mqtt In node using each broker and export them and post the flow here.

[
    {
        "id": "0abdf0de8c2a622b",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "dc7293be156e9cae",
        "type": "mqtt in",
        "z": "0abdf0de8c2a622b",
        "name": "",
        "topic": "teslamate/cars/1/#",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "eeb70a28ff34f022",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 190,
        "y": 100,
        "wires": [
            [
                "82b319ae6d932ada"
            ]
        ]
    },
    {
        "id": "82b319ae6d932ada",
        "type": "debug",
        "z": "0abdf0de8c2a622b",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 400,
        "y": 100,
        "wires": []
    },
    {
        "id": "3ade092fcf693249",
        "type": "mqtt in",
        "z": "0abdf0de8c2a622b",
        "name": "Devices",
        "topic": "devices/#",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "994221fef28b4b49",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 170,
        "y": 200,
        "wires": [
            [
                "6d2a6311b0cd865f"
            ]
        ]
    },
    {
        "id": "6d2a6311b0cd865f",
        "type": "debug",
        "z": "0abdf0de8c2a622b",
        "name": "debug 6",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 200,
        "wires": []
    },
    {
        "id": "eeb70a28ff34f022",
        "type": "mqtt-broker",
        "name": "mosquitto",
        "broker": "docker_mosquitto_1",
        "port": "1883",
        "clientid": "NodeRed",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    },
    {
        "id": "994221fef28b4b49",
        "type": "mqtt-broker",
        "name": "Mosquitto-public",
        "broker": "192.168.86.106",
        "port": "41883",
        "clientid": "NodeRed",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

Are you now in the state that the public one (which is on 192.168.86.106 port 41883) is working ok, but the original one, which I guess is a docker install, running on port 1883 is not?

Is that two separate installs of Mosquitto or two routes to the same broker?

Have you tried rebooting everything (the machines running the servers and the machines running node-red)?

Install MQTTExplorer and see if you can connect from that. If you can then you know that it is not a broker issue.