Skip to main content

mqttclient.connectionstate()

Report the current state of the connection

Availability

Agent

Returns

Integer — a connection state code (see Description)

Description

This method provides your code with a means to determine the state of the connection linking the target mqttclient object and the MQTT broker.

The value returned by the method will be one of the following:

Value State
0 Disconnected
1 Connecting
2 Connected
3 Disconnecting