liuxiulin 4 月之前
父节点
当前提交
d3d3317304
共有 1 个文件被更改,包括 14 次插入12 次删除
  1. 14 12
      services/emqx-agent/sub_dev.go

+ 14 - 12
services/emqx-agent/sub_dev.go

@@ -3,6 +3,7 @@ package main
 import (
 	"context"
 	"encoding/json"
+	"fmt"
 	mqtt "github.com/eclipse/paho.mqtt.golang"
 	"github.com/gogf/gf/os/grpool"
 	"runtime"
@@ -87,6 +88,7 @@ func (d *MqttClient) SubDevMsg(handle Handle) error {
 	if err != nil {
 		return err
 	}
+	fmt.Printf("err------------------------------%s", err)
 	client.SetMqttSetOnConnectHandler(func(cli mqtt.Client) {
 		err := d.subDevMsg(cli, handle)
 		if err != nil {
@@ -138,18 +140,18 @@ func (d *MqttClient) subDevMsg(cli mqtt.Client, handle Handle) error {
 	if err != nil {
 		return err
 	}
-	err = d.subscribeWithFunc(cli, TopicSDKLog, func(ctx context.Context, topic string, payload []byte) error {
-		return handle(ctx).Message(topic, payload)
-	})
-	if err != nil {
-		return err
-	}
-	err = d.subscribeWithFunc(cli, TopicEvent, func(ctx context.Context, topic string, payload []byte) error {
-		return handle(ctx).Message(topic, payload)
-	})
-	if err != nil {
-		return err
-	}
+	//err = d.subscribeWithFunc(cli, TopicSDKLog, func(ctx context.Context, topic string, payload []byte) error {
+	//	return handle(ctx).Message(topic, payload)
+	//})
+	//if err != nil {
+	//	return err
+	//}
+	//err = d.subscribeWithFunc(cli, TopicEvent, func(ctx context.Context, topic string, payload []byte) error {
+	//	return handle(ctx).Message(topic, payload)
+	//})
+	//if err != nil {
+	//	return err
+	//}
 	return nil
 }