diff --git a/main.go b/main.go index 228b932..1359f42 100644 --- a/main.go +++ b/main.go @@ -68,6 +68,9 @@ func main() { mqtt.NewClientOptions(). AddBroker(cfg.MQTTBroker). SetClientID(cfg.MQTTClientID). + SetConnectionLostHandler(func(_ mqtt.Client, err error) { + log.WithError(err).Fatal("Connection to broker lost") + }). SetKeepAlive(cfg.MQTTTimeout). SetPassword(cfg.MQTTPass). SetUsername(cfg.MQTTUser),