Skip to main content

mqttclient.connectionstate()

Report the current state of the connection

Availability

Agent

Returns

Integer — A connection state code

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:

Connection State Code State
0 Disconnected
1 Connecting
2 Connected
3 Disconnecting