# MQTT Nodes Connection Behaviour

**URL:** <https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954>\
**Category:** General\
**Created:** [20 May 2021 01:48 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954 "2021-05-20T01:48:21Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [27 May 2021 10:12 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954/21 "2021-05-27T10:12:46Z")

</div>

Off-topic but

> [@Colin](#):
>
> I suspect that using QoS 0 does not absolutely guarantee that the value will not be buffered in the mqtt driver

There's no absolutes in life 🙂 but I'd wager a whole £5 that any proper mqtt client/broker would only push a non-retained QOS0 message out once.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 May 2021 10:30 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954/22 "2021-05-27T10:30:48Z")

</div>

> [@cymplecy](#):
>
> any proper mqtt client/broker would only push a non-retained QOS0 message out once.

That isn't the issue here, as I understand it. The issue is that if the connection is broken for a short time (but not long enough for the mqtt to disconnect) then the mqtt node buffers messages sent to it (or at least may do, I haven't tested it with QoS 0) and sends the data when the network reconnects. So that the message arrives late.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [27 May 2021 10:32 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954/23 "2021-05-27T10:32:58Z")

</div>

> [@cymplecy](#):
>
> Off-topic

...........

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 May 2021 10:22 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954/24 "2021-05-28T10:22:52Z")

</div>

@Siothrun I have just re-read the thread, I had missed the bit about hivemq timing out immediately, but mosquitto not timing out for 20 minutes. That is very strange. Can you explain a bit more about how the device is connected to the internet, and how it is connected to the machine running mosquitto?

> [@Siothrun](#):
>
> I suspect now that the ~20 minute disconnection delay is due to the TCP/IP timeout,

You may well be onto something there. What happens if (on the device) you run a ping to the mosquitto server and leave it running while you take the sim card out. Also does the device have a network connected display of some sort? If so then how does it behave?

---

<div class="post-metadata">

**Author:** ![Siothrun](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@Siothrun](https://discourse.nodered.org/u/Siothrun)\
**Post date:** [3 June 2021 23:24 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954/25 "2021-06-03T23:24:26Z")

</div>

> [@Colin](#):
>
> Can you explain a bit more about how the device is connected to the internet, and how it is connected to the machine running mosquitto?

The Node-RED device is the MTX-GTW II-S AUS, which has a Debian GNU/Linux OS. It is connected to the internet via a SIM card.  
The Mosquitto broker is running on a VM in Azure.

> [@Colin](#):
>
> What happens if (on the device) you run a ping to the mosquitto server and leave it running while you take the sim card out. Also does the device have a network connected display of some sort? If so then how does it behave?

Are you particular about where the ping is originating from? Node-RED? OS?  
I have had a ping running to Google's DNS server (8.8.8.8) from both Node-RED and the OS while removing the SIM card whilst conducting these tests.  
I haven't tested this while pinging the Mosquitto broker, but given I can't reach Google's DNS server I wouldn't expect different results. Unless you suspect a mechanism that escapes me?

---

<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:** [2 August 2021 23:24 UTC](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954/26 "2021-08-02T23:24:41Z")

</div>

Closed on 2 August 2021 23:24 UTC

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

[Previous page](https://discourse.nodered.org/t/mqtt-nodes-connection-behaviour/45954.md?page=1)
