coreMQTT  v1.0.0
MQTT 3.1.1 Client Library
MQTT_ProcessLoop

Loop to receive packets from the transport interface. Handles keep alive.

uint32_t timeoutMs );
Parameters
[in]pContextInitialized and connected MQTT context.
[in]timeoutMsMinimum time in milliseconds that the receive loop will run, unless an error occurs.
Returns
MQTTBadParameter if context is NULL; MQTTRecvFailed if a network error occurs during reception; MQTTSendFailed if a network error occurs while sending an ACK or PINGREQ; MQTTBadResponse if an invalid packet is received; MQTTKeepAliveTimeout if the server has not sent a PINGRESP before MQTT_PINGRESP_TIMEOUT_MS milliseconds; MQTTIllegalState if an incoming QoS 1/2 publish or ack causes an invalid transition for the internal state machine; MQTTSuccess on success.

Example

// Variables used in this example.
MQTTStatus_t status;
uint32_t timeoutMs = 100;
// This context is assumed to be initialized and connected.
MQTTContext_t * pContext;
while( true )
{
status = MQTT_ProcessLoop( pContext, timeoutMs );
if( status != MQTTSuccess )
{
// Determine the error. It's possible we might need to disconnect
// the underlying transport connection.
}
else
{
// Other application functions.
}
}
MQTT_ProcessLoop
MQTTStatus_t MQTT_ProcessLoop(MQTTContext_t *pContext, uint32_t timeoutMs)
Loop to receive packets from the transport interface. Handles keep alive.
Definition: core_mqtt.c:2121
MQTTStatus_t
MQTTStatus_t
Return codes from MQTT functions.
Definition: core_mqtt_serializer.h:105
MQTTContext_t
A struct representing an MQTT connection.
Definition: core_mqtt.h:156
MQTTSuccess
@ MQTTSuccess
Definition: core_mqtt_serializer.h:106