# IPv6 connect/disconnect issue with mqtt in or out nodes

**URL:** <https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444>\
**Category:** General\
**Tags:** mqtt\
**Created:** [30 January 2023 21:26 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444 "2023-01-30T21:26:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lepgithub](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lepgithub/32/49422_2.png) [@lepgithub](https://discourse.nodered.org/u/lepgithub)\
**Post date:** [30 January 2023 21:26 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444/1 "2023-01-30T21:26:50Z")

</div>

I'm slowly moving my projects to utilize IPv6, but I found an issue while using a single MQTT IN or OUT node where during a modified node deployment 50% of the time it will disconnect from an IPv6 only broker.

I can reproduce this behavior reliably under NR v3.0.2, ubuntu or rpi os, node.js (v14, v16, or v18) and latest mosquitto broker (TLS or not). I've tested with a few local brokers, remotely on AWS EC2, or [test.mosqutto.org](http://test.mosqutto.org) (2001:41d0:1:925e::1). I usually only change the QOS level to trigger a modified node deploy.

Logs from NR and broker show only a normal (non-error) IPv6 client disconnect/connect.

Example MQTT IN node:

```auto
[
    {
        "id": "497c7a765e26de0b",
        "type": "mqtt in",
        "z": "5ac27d09b93b4452",
        "name": "",
        "topic": "nodered/ipv6/test",
        "qos": "1",
        "datatype": "auto-detect",
        "broker": "5d0c05a3ecea1f46",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 170,
        "y": 200,
        "wires": [
            [
                "30b8c8c7159c6c89"
            ]
        ]
    },
    {
        "id": "30b8c8c7159c6c89",
        "type": "debug",
        "z": "5ac27d09b93b4452",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 340,
        "y": 200,
        "wires": []
    },
    {
        "id": "5d0c05a3ecea1f46",
        "type": "mqtt-broker",
        "name": "",
        "broker": "2001:41d0:1:925e::1",
        "port": "1883",
        "clientid": "",
        "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": ""
    }
]

```

Example MQTT OUT node:

```auto
[
    {
        "id": "99407118f264a1b3",
        "type": "mqtt out",
        "z": "25e4b7bcd7dc34bb",
        "name": "",
        "topic": "nodered/ipv6/test",
        "qos": "2",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "6fd98d9498ff1cae",
        "x": 550,
        "y": 780,
        "wires": []
    },
    {
        "id": "32b3f8142f268458",
        "type": "inject",
        "z": "25e4b7bcd7dc34bb",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 330,
        "y": 780,
        "wires": [
            [
                "99407118f264a1b3"
            ]
        ]
    },
    {
        "id": "6fd98d9498ff1cae",
        "type": "mqtt-broker",
        "name": "",
        "broker": "2001:41d0:1:925e::1",
        "port": "1883",
        "clientid": "",
        "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": ""
    }
]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 January 2023 23:41 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444/2 "2023-01-30T23:41:06Z")

</div>

If you have only one subscription and you make a change that makes the MQTT node be redeployed (i.e if you modify it or use full deploy mode) you will be hitting a known bug

See here: [MQTT not reconnecting if only only one mqtt node using it](https://discourse.nodered.org/t/mqtt-not-reconnecting-if-only-only-one-mqtt-node-using-it/69381)

And here: [MQTT not reconnecting on edit if only only one mqtt node using the config node · Issue #3927 · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues/3927)

Fixed in next release (v3.1.0)

---

<div class="post-metadata">

**Author:** ![lepgithub](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lepgithub/32/49422_2.png) [@lepgithub](https://discourse.nodered.org/u/lepgithub)\
**Post date:** [1 February 2023 05:49 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444/3 "2023-02-01T05:49:22Z")

</div>

Thanks for the info and that explains why I haven't seen the same issue with IPv4 since most of my broker configs are shared among many MQTT nodes. I now look forward to V3.1.0!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [3 February 2023 11:18 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444/4 "2023-02-03T11:18:08Z")

</div>

> [@lepgithub](#):
>
> I now look forward to V3.1.0

[🎉 Node-RED 3.1.0-beta.1 released](https://discourse.nodered.org/t/node-red-3-1-0-beta-1-released/74644) 😉

Would be cool if you can try it out and confirm?

---

<div class="post-metadata">

**Author:** ![lepgithub](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lepgithub/32/49422_2.png) [@lepgithub](https://discourse.nodered.org/u/lepgithub)\
**Post date:** [4 February 2023 02:15 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444/5 "2023-02-04T02:15:43Z")

</div>

I installed v3.1 beta on ubuntu and verified deploying a single modified MQTT node does not disconnect from the broker. So it appears it's fixed. Awesome job!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 April 2023 02:16 UTC](https://discourse.nodered.org/t/ipv6-connect-disconnect-issue-with-mqtt-in-or-out-nodes/74444/6 "2023-04-05T02:16:25Z")

</div>

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