Is it logical to have the same MQTT handle for publishing messages to AWS and for OTA updates?
I am using ESP32 and running into a memory issues and trying to figure out where to optimize. And so far I had all other custom apps running and MQTT publisher app and then additionally I was just using OTA demo task for updates.
I am trying to build an app that combines the shadow and ota library.
When connecting both at the same time, only the last one connecting works correctly.
Using a shared handle is prevented by an assertion in the shadow code.
The shadow client obviously connects to all the $aws/things//update topics and the ota agent does so for $aws/things//jobs/ ones.
The subscriptions by both clients needs to be made with the same client id, because the thingname is used as the topic that gets subscribed to.
This results in duplicate client id errors in the logs.
If I change the thingname for one client, this results in a different mqtt clientid and both “work”, but only the client with the thingname = clientid gets traffic.
Is there a way around that ?
The only other possibility would be to stop shadow traffic and connect the ota agent periodically.
Use different ids in xConnectParams.pucClientId for SHADOW_ClientConnect and MQTT_AGENT_Connect, then pass real thingname to OTA_AgentInit.
I use correct thingname with shadow for clientid and thingname in callbacks, and a different name for ota.