瀏覽代碼

更新订阅

liuxiulin 4 月之前
父節點
當前提交
70140eb9d4
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      services/emqx-agent/sub_dev.go

+ 2 - 2
services/emqx-agent/sub_dev.go

@@ -97,7 +97,7 @@ func (d *MqttClient) SubDevMsg(handle Handle) error {
 }
 
 func (d *MqttClient) subDevMsg(cli mqtt.Client, handle Handle) error {
-	err := d.subscribeWithFunc(cli, "TopicConnectStatus", d.subConnectStatus(handle))
+	err := d.subscribeWithFunc(cli, TopicConnectStatus, d.subConnectStatus(handle))
 	if err != nil {
 		return err
 	}
@@ -144,7 +144,7 @@ func (d *MqttClient) subDevMsg(cli mqtt.Client, handle Handle) error {
 	//if err != nil {
 	//	return err
 	//}
-	err = d.subscribeWithFunc(cli, "TopicEvent", func(ctx context.Context, topic string, payload []byte) error {
+	err = d.subscribeWithFunc(cli, TopicEvent, func(ctx context.Context, topic string, payload []byte) error {
 		return handle(ctx).Message(topic, payload)
 	})
 	if err != nil {