- Newest
- Most votes
- Most comments
Hi,
Yes, there is a limitation of 8 subscriptions per subscribe request, so that could be the problem. You mentioned log files, what verbosity is set? You may be able to see more details by changing the logging level to DEBUG, but it's likely if your are attempting >8 subscriptions in a single call that this is the reason.
The most straightforward way would be to change your code to iterate through your topic subscriptions and make separate calls limited to 8 topics. Since it works for an initial session, is the logic different during reconnect?
Another approach would be to use persistent sessions. This would allow your initial connection to subscribe to the topic list (with the constraint of 8 per request), but then when you do a reconnect IoT Core will automatically reinstate all subscriptions.
When a client connects to the message broker using a persistent session, the message broker saves all subscriptions that the client makes during the connection. When the client disconnects, the message broker stores unacknowledged QoS 1 messages and new QoS 1 messages published to topics to which the client is subscribed. ... When the client reconnects to its persistent session, all subscriptions are reinstated and all stored messages are sent to the client at a maximum rate of 10 messages per second.
Also, the AWS IoT Device SDKs have a lot of logic built-in (plus MQTT 5 support!). If it's possible, using the JavaScript SDK might help with this.
Please respond (and/or accept if this resolves your question) and if possible, share some code snippets for the initial connect and reconnect logic in your application.
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 10 months ago

Hey Gavin, thank you for the reply. I was able to confirm via iot debug logs that the subscribe requests that were failing had e.g. 14 topics in the batch :) I just did some initial testing setting
clean: falsewith the mqtt client and it seems promising. Still going to do further testing but it does appear that was the issue I was hitting!At some point I would like to upgrade to mqtt 5 but haven't had the chance to look into it yet.