32 lines
1.4 KiB
Markdown
32 lines
1.4 KiB
Markdown
---
|
|
tag: api
|
|
type: function
|
|
name: state
|
|
returns:
|
|
type: int
|
|
values:
|
|
- value: '-4 : <code>MQTT_CONNECTION_TIMEOUT</code>'
|
|
description: the server didn't respond within the keepalive time
|
|
- value: '-3 : <code>MQTT_CONNECTION_LOST</code>'
|
|
description: the network connection was broken
|
|
- value: '-2 : <code>MQTT_CONNECT_FAILED</code>'
|
|
description: the network connection failed
|
|
- value: '-1 : <code>MQTT_DISCONNECTED</code>'
|
|
description: the client is disconnected cleanly
|
|
- value: '0 : <code>MQTT_CONNECTED</code>'
|
|
description: the client is connected
|
|
- value: '1 : <code>MQTT_CONNECT_BAD_PROTOCOL</code>'
|
|
description: the server doesn't support the requested version of MQTT
|
|
- value: '2 : <code>MQTT_CONNECT_BAD_CLIENT_ID</code>'
|
|
description: the server rejected the client identifier
|
|
- value: '3 : <code>MQTT_CONNECT_UNAVAILABLE</code>'
|
|
description: the server was unable to accept the connection
|
|
- value: '4 : <code>MQTT_CONNECT_BAD_CREDENTIALS</code>'
|
|
description: the username/password were rejected
|
|
- value: '5 : <code>MQTT_CONNECT_UNAUTHORIZED</code>'
|
|
description: 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 <code>PubSubClient.h</code>. |