Hi everyone, I’m having some troubles with MQTT over a TCP socket. I am essentially using the same code as the one provided in the library, socket creation, connection, mqtt subscribe/publish/ping are working fine.
After connecting to a MQTT broker and subscribing to a topic, I poll “AT+USORD=0,0” to watch for new data coming. If data is published (using mosquitto_pub) to the topic every 2 o 3 seconds or so, then the socket reads everything and no data is lost. On the contrary if data publication (still using mosqutito_pub) is done every 5+ seconds, then the socket read seems to silently go idle (I keep on reading “+USORD: 0,0”). In this case sending data to the broker (for example through a ping) seems to re establish the communication and I can again receive data for a few seconds.
I tried this with a private broker and test.mosquitto.org and I got the same result.
I tried to enable the “keep alive” TCP socket option but with no result.
I run out of ideas, any input would be greatly appreciated!