MKR 1500 - Sketch for connecting to MQTT Broker

I have been trying to establish a stable connection to an MQTT broker for a long time.
Unfortunately, the connection breaks off after different times. Sometimes it runs for a few days and sometimes just a few hours. I am using the MKRNB, Arduino-mqtt librarys and a 1NCE Sim Card.
Is there anyone who has a stable connection and would share the code here. I would be very grateful.

I have one that has ran for weeks to my personal MQTT broker (without any security other than a userid and password). You might take a look at to see if it might be of any interest. I use an AT@T SIM. There are many issues with the libraries and seems to be some hardware issues, not sure if the hardware issues are with Arduino, UBlox, or both.