@ -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
@ -29,3 +29,7 @@ run-pub:
run-sub:
go run ./cmd/subscriber/main.go
.PHONEY: run-sub
dev-logs:
docker logs mosquitto -f
.PHONEY: dev-logs
@ -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) {
@ -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)