|
@@ -97,13 +97,12 @@ func (d *MqttClient) SubDevMsg(handle Handle) error {
|
|
}
|
|
}
|
|
|
|
|
|
func (d *MqttClient) subDevMsg(cli mqtt.Client, handle Handle) error {
|
|
func (d *MqttClient) subDevMsg(cli mqtt.Client, handle Handle) error {
|
|
- //err := d.subscribeWithFunc(cli, TopicConnectStatus, d.subConnectStatus(handle))
|
|
|
|
- //server.Log.Infof("subDevMsg")
|
|
|
|
- //if err != nil {
|
|
|
|
- // server.Log.Infof("subDevMsg err:%v", err)
|
|
|
|
- // return err
|
|
|
|
- //}
|
|
|
|
- err := d.subscribeWithFunc(cli, TopicThing, func(ctx context.Context, topic string, payload []byte) error {
|
|
|
|
|
|
+ err := d.subscribeWithFunc(cli, TopicConnectStatus, d.subConnectStatus(handle))
|
|
|
|
+ if err != nil {
|
|
|
|
+ server.Log.Infof("subDevMsg err:%v", err)
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ err = d.subscribeWithFunc(cli, TopicThing, func(ctx context.Context, topic string, payload []byte) error {
|
|
return handle(ctx).Message(topic, payload)
|
|
return handle(ctx).Message(topic, payload)
|
|
})
|
|
})
|
|
if err != nil {
|
|
if err != nil {
|