Skip to content

Returns the current state of the client #76

@timurufa86

Description

@timurufa86

Make sure you have the latest version of ESP8266MQTTMesh before reporting an issue.

Please Provide the following information:

  • ESP8266MQTTMesh version: last
  • AsyncMQTTClient version: laST
  • ESPAsyncTCP version: LAST
  • ESP8266 Core version: LAST

If you are you using platformio or Arduino, which one?

Description of problem:

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

Returns
int - the client state, which can take the following values (constants defined in PubSubClient.h):
-4 : MQTT_CONNECTION_TIMEOUT - the server didn't respond within the keepalive time
-3 : MQTT_CONNECTION_LOST - the network connection was broken
-2 : MQTT_CONNECT_FAILED - the network connection failed
-1 : MQTT_DISCONNECTED - the client is disconnected cleanly
0 : MQTT_CONNECTED - the client is connected
1 : MQTT_CONNECT_BAD_PROTOCOL - the server doesn't support the requested version of MQTT
2 : MQTT_CONNECT_BAD_CLIENT_ID - the server rejected the client identifier
3 : MQTT_CONNECT_UNAVAILABLE - the server was unable to accept the connection
4 : MQTT_CONNECT_BAD_CREDENTIALS - the username/password were rejected
5 : MQTT_CONNECT_UNAUTHORIZED - the client was not authorized to connect
IS THERE A SIMILAR FUNCTION?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions