diff --git a/.mosquitto/mosquitto.conf b/.mosquitto/mosquitto.conf index 8c4f42d..7739132 100644 --- a/.mosquitto/mosquitto.conf +++ b/.mosquitto/mosquitto.conf @@ -23,7 +23,7 @@ allow_anonymous false # allow_zero_length_clientid # auto_id_prefix -# password_file +password_file /etc/mosquitto/passwd # plugin # plugin_opt_* # psk_file diff --git a/Makefile b/Makefile index f2b2ff7..565c05b 100644 --- a/Makefile +++ b/Makefile @@ -28,4 +28,8 @@ run-pub: run-sub: go run ./cmd/subscriber/main.go -.PHONEY: run-sub \ No newline at end of file +.PHONEY: run-sub + +dev-logs: + docker logs mosquitto -f +.PHONEY: dev-logs \ No newline at end of file diff --git a/cmd/publisher/main.go b/cmd/publisher/main.go index 995a30e..0e37f46 100644 --- a/cmd/publisher/main.go +++ b/cmd/publisher/main.go @@ -15,7 +15,7 @@ func main() { options := mqtt.NewClientOptions() options.AddBroker(fmt.Sprintf("tcp://%s:%s", *common.BrokerHost, *common.BrokerPort)) - // options.SetClientID("go_mqtt_client") + options.SetClientID("go_mqtt_pub_client") options.SetUsername("dirp") options.SetPassword("dirp") options.SetDefaultPublishHandler(func(client mqtt.Client, msg mqtt.Message) { diff --git a/cmd/subscriber/main.go b/cmd/subscriber/main.go index ab0af16..9842305 100644 --- a/cmd/subscriber/main.go +++ b/cmd/subscriber/main.go @@ -37,7 +37,7 @@ func main() { var port = 1883 opts := mqtt.NewClientOptions() opts.AddBroker(fmt.Sprintf("tcp://%s:%d", broker, port)) - // opts.SetClientID("go_mqtt_client") + opts.SetClientID("go_mqtt_sub_client") opts.SetUsername("dirp") opts.SetPassword("dirp") opts.SetDefaultPublishHandler(messagePubHandler)