.
This commit is contained in:
parent
cf09ee5fe9
commit
8a7f93f1f1
|
@ -215,10 +215,10 @@ func mqtt_begin() {
|
||||||
opts_cms_bi.SetUsername(CMS_ACCESS_TOKEN_BI)
|
opts_cms_bi.SetUsername(CMS_ACCESS_TOKEN_BI)
|
||||||
opts_cms_bi.SetPassword(CMS_PASS_BI)
|
opts_cms_bi.SetPassword(CMS_PASS_BI)
|
||||||
opts_cms_bi.SetCleanSession(true)
|
opts_cms_bi.SetCleanSession(true)
|
||||||
mqtt_cms_bi = mqtt.NewClient(opts_cms_bi)
|
|
||||||
opts_cms_bi.SetConnectionLostHandler(MQTTLostConnectHandler)
|
opts_cms_bi.SetConnectionLostHandler(MQTTLostConnectHandler)
|
||||||
opts_cms_bi.SetOnConnectHandler(MQTTOnConnectHandler)
|
opts_cms_bi.SetOnConnectHandler(MQTTOnConnectHandler)
|
||||||
|
|
||||||
|
mqtt_cms_bi = mqtt.NewClient(opts_cms_bi)
|
||||||
if token_1 := mqtt_cms_bi.Connect(); token_1.Wait() && token_1.Error() == nil {
|
if token_1 := mqtt_cms_bi.Connect(); token_1.Wait() && token_1.Error() == nil {
|
||||||
//file.Write_log("MQTT CMS Beetsoft Connected\n", path_log)
|
//file.Write_log("MQTT CMS Beetsoft Connected\n", path_log)
|
||||||
if Debug == 1 {
|
if Debug == 1 {
|
||||||
|
@ -232,6 +232,11 @@ func mqtt_begin() {
|
||||||
fmt.Printf("-------------------\n")
|
fmt.Printf("-------------------\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if token := mqtt_cms_bi.Subscribe(CMS_TOPIC_IN, 0, mqtt_messageHandler); token.Wait() && token.Error() != nil {
|
||||||
|
fmt.Println(token.Error())
|
||||||
|
} else {
|
||||||
|
fmt.Println("Subcriber is MQTTOnConnectHandler () OKIE ")
|
||||||
|
}
|
||||||
|
|
||||||
// opts_cms_bi.OnConnect = func(c mqtt.Client) {
|
// opts_cms_bi.OnConnect = func(c mqtt.Client) {
|
||||||
// fmt.Printf("Client connected, subscribing to: " + CMS_TOPIC_IN)
|
// fmt.Printf("Client connected, subscribing to: " + CMS_TOPIC_IN)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user