Closed happychenleilei closed 1 year ago
问题描述: MQTT断线再次重连后,之前订阅过的主题,无法收到消息 期望:MQTT断线后重连,之前订阅的消息能够正常收到消息 代码如下,
func NewMQTTServer( c *conf.Bootstrap, svc *service.OperationStatService, ) *mqtt.Server { ctx := context.Background() var opts = []mqtt.ServerOption{ mqtt.WithAddress([]string{c.Server.Mqtt.Addr}), mqtt.WithCodec("json"), mqtt.WithAuth(c.Server.Mqtt.Username, c.Server.Mqtt.Password), mqtt.WithClientId(c.Server.Mqtt.ClientId), mqtt.WithCleanSession(true), } srv := mqtt.NewServer(opts...) _ = srv.RegisterSubscriber( ctx, c.OperationStat.SubTopic, biz.RegisterDeviceAckJsonHandler(svc.DeviceAckHandler), biz.DeviceAckCreator, ) svc.SetMqttBroker(srv) return srv }
问题描述: MQTT断线再次重连后,之前订阅过的主题,无法收到消息 期望:MQTT断线后重连,之前订阅的消息能够正常收到消息 代码如下,