ENOMEM with MQTT Subscription List

I have a working MQTT subscription list, when I add a new topic for subscription my subscribe fails with ENOMEM error -12.

If I remove another topic, I can add new topics successfully so I know its not syntax or an issue with the topic.  I have increased the stack and heap and still see the error.  Is there any way to dig deeper into what is causing the subscribe error?

Parents Reply
  • The .list field in the mqtt_subscription_list struct should be an array, not a single struct.

    This works for me:

    	struct mqtt_topic subscribe_topics[] = {
    		{
    			.topic = {
    				.utf8 = CONFIG_MQTT_SUB_TOPIC,
    				.size = strlen(CONFIG_MQTT_SUB_TOPIC)
    			},
    			.qos = MQTT_QOS_1_AT_LEAST_ONCE
    		},
    		{
    			.topic = {
    				.utf8 = "foo",
    				.size = strlen("foo")
    			},
    			.qos = MQTT_QOS_1_AT_LEAST_ONCE
    		}
    	};
    
    	const struct mqtt_subscription_list subscription_list = {
    		.list = subscribe_topics,
    		.list_count = ARRAY_SIZE(subscribe_topics),
    		.message_id = 1234
    	};

Children
Related