Files
pubsubclient/_posts/2000-05-03-state.md
2020-05-21 01:17:42 +01:00

1.4 KiB

tag, type, name, returns
tag type name returns
api function state
type values
int
value description
-4 : <code>MQTT_CONNECTION_TIMEOUT</code> the server didn't respond within the keepalive time
value description
-3 : <code>MQTT_CONNECTION_LOST</code> the network connection was broken
value description
-2 : <code>MQTT_CONNECT_FAILED</code> the network connection failed
value description
-1 : <code>MQTT_DISCONNECTED</code> the client is disconnected cleanly
value description
0 : <code>MQTT_CONNECTED</code> the client is connected
value description
1 : <code>MQTT_CONNECT_BAD_PROTOCOL</code> the server doesn't support the requested version of MQTT
value description
2 : <code>MQTT_CONNECT_BAD_CLIENT_ID</code> the server rejected the client identifier
value description
3 : <code>MQTT_CONNECT_UNAVAILABLE</code> the server was unable to accept the connection
value description
4 : <code>MQTT_CONNECT_BAD_CREDENTIALS</code> the username/password were rejected
value description
5 : <code>MQTT_CONNECT_UNAUTHORIZED</code> the client was not authorized to connect

Returns the current state of the client. If a connection attempt fails, this can be used to get more information about the failure.

All of the values have corresponding constants defined in PubSubClient.h.