make sure to comply with MQTT spec (#14037)

- keep-alive cannot be 0 by default anymore
- client_id cannot be empty

fixes #13993
This commit is contained in:
Harshavardhana
2022-01-06 11:25:39 -08:00
committed by GitHub
parent 0e31cff762
commit 0d3ae3810f
3 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -209,8 +209,12 @@ func NewMQTTTarget(id string, args MQTTArgs, doneCh <-chan struct{}, loggerOnce
args.MaxReconnectInterval = 10 * time.Minute
}
if args.KeepAlive == 0 {
args.KeepAlive = 10 * time.Second
}
options := mqtt.NewClientOptions().
SetClientID("").
SetClientID(id).
SetCleanSession(true).
SetUsername(args.User).
SetPassword(args.Password).