How many messages can the Cloud Starter broker queue for an offline client?
Question
How many QoS 1 and QoS 2 messages can the Cloud Starter broker queue for an offline client, which has a persistent session?
Answer
For a client connected with a persistent session, the Cloud Starter broker will queue up to 10,000 QoS 1 and QoS 2 messages. You can read more about this in our MQTT Essentials lectures: Persistent Session and Queuing Messages.
To explore how persistent sessions work, we recommend using the MQTT-CLI tool. You can find detailed instructions and a demonstration in this video: Using MQTT-CLI Tool for Connecting Clients with Persistent Sessions.
Here’s a command example to subscribe to a Cloud Starter broker:
mqtt subscribe --topic "#" --qos 1 --no-cleanStart --sessionExpiryInterval 3600 --secure --port 8883 --host starter-broker.a01.euc1.aws.hivemq.cloud --user MYUSER --password MYPASS --showTopics --identifier MYCLIENT
This command will connect to the Cloud Starter broker at starter-broker.a01.euc1.aws.hivemq.cloud
on port 8883 using a secure TLS connection. Create a user with permission to subscribe. Replace MYUSER
and MYPASS
with your username and password, and MYCLIENT
with your client ID. The client will subscribe to all topics using a persistent session with an expiry interval of one hour. To close the connection, simply press Ctrl+C. The client will become offline, but the persistent session will stay on the broker until the session’s expiry interval ends.
For further assistance on installing the MQTT-CLI tool, please refer to this guide: Installing MQTT-CLI Tool. Additionally, you can learn how to publish and subscribe with the MQTT-CLI in this tutorial: Publishing and Subscribing with MQTT-CLI.