step one:
fmt.Println("start")
go runTest(Service, Provider, contentTopic, 1, time.Second*5)
step two:
func runTest(Service *services.Service, provider *provider.Provider, topic string, qos int, timeout time.Duration) {
fmt.Println("subscribe func one")
token := Service.Mqtt.Client.Subscribe(topic, byte(qos), func(client mqtt.Client, msg mqtt.Message) {
fmt.Println("subscribe func two")
if data["type"] == "test" {
runFunc()
return
}
return
}
The first time, all logs are shown from start to finish, but from the second time onward, it only starts logging when I publish content to the topic, starting from:
fmt.Println("subscribe func one")
How can I stop this subscription from continuing?