I am lost, I use an emqx 5.015 server and everything works except qos1 and 2. I tried everything possible with different clients, I post everything in qos 2 and I subscribe everything in qos 2 and if I have a device not connected it never receives the message when reconnected. I’m going crazy. Is there anything to configure?
Hello and sorry for the late response,
There are several things that could cause this, starting from the easiest to troubleshoot:
- The client connects with Clean Start flag set to 1. It means the broker drops all the session information and starts from scratch.
- Session expires while the client is offline. In MQTT 5.0 version of the protocol the client can set expiry interval explicitly, otherwise the following configuration parameter is used: EMQX Configurational Manual | EMQX 5.4.1 Docs
Both situations can be ruled out by inspecting the CONNACK packet from the broker, Session Present bit would be 0 if any of the above scenarios are in play.
EMQX could be to blame too:
- Currently the broker stores the offline sessions in RAM. If the broker restarts while the client is gone, the messages disappear. (We are working on the persistence feature for the sessions and messages)
- If the number of messages exceeds this value, they will be dropped EMQX Configurational Manual | EMQX 5.4.1 Docs This can be checked in the dashboard.
If none of the above scenarios check out, please feel free to collect wireshark/tcpdump logs and open a github issue.