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.
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