浏览代码

恢复重连

liuxiulin 4 月之前
父节点
当前提交
850cde4483
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      services/emqx-agent/client/mqtt_client.go

+ 2 - 2
services/emqx-agent/client/mqtt_client.go

@@ -56,8 +56,8 @@ func initMqttClient(conf *MqttConfig) (mc MQTT.Client, err error) {
 		opts.AddBroker(broker)
 	}
 	opts.SetClientID(fmt.Sprintf("%s_%s", conf.ClientId, guid.S())).
-		SetUsername(conf.User).SetPassword(conf.Password)
-	//SetConnectRetry(true)
+		SetUsername(conf.User).SetPassword(conf.Password).
+		SetConnectRetry(true)
 	opts.SetConnectionAttemptHandler(func(broker *url.URL, tlsCfg *tls.Config) *tls.Config {
 		server.Log.Infof("connect to %s", broker.String())
 		return tlsCfg