6 years, 3 months ago.

mqtt yield broken?

I am trying to write an application for my Nucleo F746ZG, which uses two MQTT topics (in/out), to have a persistent communication with my server, so I checked out the HelloMQTT code, and modified it slightly, to have an infinite loop, but thats not really working because:

yield blocks for about a minute, instead 100ms, and after about a minute it stops receiving any messages, but only blocks for about 1s

loop

static int loopCounter = 0;
set_time(0);
time_t lastTime = time(NULL);
while (true){
       logMessage("loop: %d\r\n",++loopCounter);
        client.yield(100);
        time_t seconds = time(NULL);
        int diff = seconds -lastTime;
        logMessage("time diff: %d\r\n",diff);
        lastTime = seconds;

       //send messages queued by other thread
        if(!outQueue.empty()){
             ...
       }
}

1 Answer

6 years, 1 month ago.

I have the same problem, to see if they can not help. Thank you