Browse Source

更新订阅

liuxiulin 4 tháng trước cách đây
mục cha
commit
70140eb9d4
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  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 {