[][src]Function paho_mqtt_sys::MQTTAsync_connect

pub unsafe extern "C" fn MQTTAsync_connect(
    handle: MQTTAsync,
    options: *const MQTTAsync_connectOptions
) -> c_int

This function attempts to connect a previously-created client (see MQTTAsync_create()) to an MQTT server using the specified options. If you want to enable asynchronous message and status notifications, you must call MQTTAsync_setCallbacks() prior to MQTTAsync_connect(). @param handle A valid client handle from a successful call to MQTTAsync_create(). @param options A pointer to a valid MQTTAsync_connectOptions structure. @return ::MQTTASYNC_SUCCESS if the client connect request was accepted. If the client was unable to connect to the server, an error code is returned via the onFailure callback, if set. Error codes greater than 0 are returned by the MQTT protocol:

1: Connection refused: Unacceptable protocol version
2: Connection refused: Identifier rejected
3: Connection refused: Server unavailable
4: Connection refused: Bad user name or password
5: Connection refused: Not authorized
6-255: Reserved for future use