My client connects with the following parameters:
- Clean Session: False
- Client ID: Fixed (same every time)
- Subscribed with QoS=1
- Message Published with QoS=1
I am trying to verify that if the broker receives messages when the client is offline, the messages are queued on the broker and sent to client when it comes online again.
However, I find that the broker does not send anything to the client on reconnect.
This is how I tested: Connect client to broker using the four parameters mentioned above. Subscribe to topics of interest with QoS=1 Disconnect client
Using another client program and another client id, connect to the broker Publish message to the same topic that was subscribed to by the now offline client. Wait for a few seconds, now reconnect the offline client with the same connection settings as before.
Expected Result: As soon as connection is re-established the client will receive messages that were sent to its topic while it was offline.
Actual Result: Client gets no messages. It is able to receive any new messages that are sent AFTER it is connected, but no offline messages.**
I have verified using Wireshark that the SUBSCRIBE and message PUBLISH packets sent to the server have QoS=1 and clean session flag is false in CONNECT packet.
Broker: Mosquitto v1.4.11
MQTT Config File:
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
log_type debug
listener 9001
protocol websockets
listener 1883
protocol mqtt
allow_anonymous false
acl_file /path/to/acl_file
password_file /path/to/password_file