# The connection with Azure IoT Hub is lost and it does not recover.

**URL:** <https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523>\
**Category:** General\
**Created:** [18 June 2020 05:55 UTC](https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523 "2020-06-18T05:55:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yossy4](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yossy4](https://discourse.nodered.org/u/yossy4)\
**Post date:** [18 June 2020 05:55 UTC](https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523/1 "2020-06-18T05:55:47Z")

</div>

Hi, All.  
The information obtained using Node-RED is sent to Azure via Azure IoT Hub.

 ![キャプチャ](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a0a68d4f86e98715d34b1458ee6a477265432881.png)  
After connecting, there is no problem for a while.  
The connection will be disconnected in tens of minutes if it is fast and in days if it is slow.

When I check it with Azure Log Analytics, I get the following error:

> 404104 DeviceConnectionClosedRemotely

If this error occurs, the connection will not be restored unless you restart the flow, deploy, or restart the browser.  
You can't do that every time...

First of all, I would like to establish a method to prevent disconnection and a method to reconnect even if disconnection occurs.  
However, I can't find it by searching the literature.

Can someone give me a hint.

Thanks.

---

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [18 June 2020 14:40 UTC](https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523/2 "2020-06-18T14:40:30Z")

</div>

Hi,

I cant help you to reconnect but i believe i can help you to disconnect less.

Azure iot hub allows only 1 single connection from a single device id. So it disconnecta you if you try to connect from 2 different places at the same time

---

<div class="post-metadata">

**Author:** ![yossy4](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yossy4](https://discourse.nodered.org/u/yossy4)\
**Post date:** [19 June 2020 10:42 UTC](https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523/3 "2020-06-19T10:42:21Z")

</div>

Hi,

Thank you for reply.  
I only connect to one Raspberry Pi and Azure IoT Hub.

Probably not the condition you told me.  
Does anyone know how to automatically recover if the connection is lost?

Thanks.

---

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [19 June 2020 10:48 UTC](https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523/4 "2020-06-19T10:48:34Z")

</div>

some additional info for understanding :

> **[Troubleshooting Azure IoT Hub error 404104 DeviceConnectionClosedRemotely](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-troubleshoot-error-404104-deviceconnectionclosedremotely)**
>
> Understand how to fix error 404104 DeviceConnectionClosedRemotely

You can also use http to send message to iot hub, if you find mqtt to complex. You can do it with a regular http request node.

---

<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:** [18 August 2020 10:48 UTC](https://discourse.nodered.org/t/the-connection-with-azure-iot-hub-is-lost-and-it-does-not-recover/28523/5 "2020-08-18T10:48:37Z")

</div>

Closed on 18 August 2020 10:48 UTC

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