Skip to content

Commit b467c59

Browse files
feat: Randomizes MQTT clientID
1 parent 8f1d054 commit b467c59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
mqtt "github.com/eclipse/paho.mqtt.golang"
12+
"github.com/google/uuid"
1213
"github.com/joho/godotenv"
1314
"github.com/prometheus/client_golang/prometheus/promhttp"
1415
"github.com/redis/go-redis/v9"
@@ -110,6 +111,7 @@ func main() {
110111

111112
options := mqtt.NewClientOptions()
112113
options.AddBroker(mqttAddress)
114+
options.SetClientID(uuid.NewString())
113115
options.SetUsername(mqttUsername)
114116
options.SetPassword(mqttPassword)
115117
mqttClient := mqtt.NewClient(options)

0 commit comments

Comments
 (0)