mochi-mqtt / server

The fully compliant, embeddable high-performance Go MQTT v5 server for IoT, smarthome, and pubsub
MIT License
1.29k stars 222 forks source link

Fix #352 message does not save at session when client is disconnect. #354

Closed werbenhu closed 10 months ago

werbenhu commented 11 months ago

For #352, According to MQTT spec 3.1.2.4 Clean Session , if the client does not expire, we should retain the client's subscriptions upon reconnection. However, I tested Mosquitto, and it does not support this feature. Therefore, I think making this an optional capability is a good idea. You can enable this capability by coding as follows:

capabilities := mqtt.DefaultServerCapabilities
capabilities.Compatibilities.TakeoverSubInheritable = true

server := mqtt.New(&mqtt.Options{
    InlineClient: true,
    Capabilities: capabilities,
})
coveralls commented 11 months ago

Pull Request Test Coverage Report for Build 7337508374


Totals Coverage Status
Change from base Build 7294752060: 0.0%
Covered Lines: 5532
Relevant Lines: 5602

💛 - Coveralls