|
@@ -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
|
|
|
}
|
|
|
|