jjzjj

integrationResult

全部标签

go - 在程序 MQTT 期间更改订阅主题

我有一个MQTTGo程序订阅了主题“info”,我在其中收到了一条JSON消息。我验证该JSON消息,如果验证成功,我想开始订阅新主题“info_updates”。这是我的订阅代码:funcInfo(){c:=make(chanos.Signal,1)signal.Notify(c,os.Interrupt,syscall.SIGTERM)opts:=MQTT.NewClientOptions().AddBroker("tcp://test.mosquitto.org:1883")opts.SetDefaultPublishHandler(f)topic:="info"//Iwantt