DeleteConnection - AWS IoT

DeleteConnection

Disconnects a connected MQTT client from AWS IoT Core. When you disconnect a client, AWS IoT Core closes the client's network connection and optionally cleans the session state.

Requires permission to access the DeleteConnection action.

Request Syntax

DELETE /connections/clientId?cleanSession=cleanSession&preventWillMessage=preventWillMessage HTTP/1.1

URI Request Parameters

The request uses the following URI parameters.

cleanSession

Specifies whether to remove the client's persistent session state when disconnecting. Set to TRUE to delete all session information, including subscriptions and queued messages. Set to FALSE to preserve the session state for persistent sessions. For clean sessions this parameter will be ignored. By default, this is set to FALSE (preserves the session state).

clientId

The unique identifier of the MQTT client to disconnect. The client ID can't start with a dollar sign ($).

MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters.

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: ^[^$].*

Required: Yes

preventWillMessage

Controls if AWS IoT Core publishes the client's Last Will and Testament (LWT) message upon disconnection. Set to TRUE to prevent publishing the LWT message. Set to FALSE to ensure that LWT is published. By default, this is set to FALSE (LWT message is published).

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

ForbiddenException

The caller isn't authorized to make the request.

HTTP Status Code: 403

InternalFailureException

An unexpected error has occurred.

HTTP Status Code: 500

InvalidRequestException

The request is not valid.

HTTP Status Code: 400

ResourceNotFoundException

The specified resource does not exist.

HTTP Status Code: 404

ThrottlingException

The rate exceeds the limit.

HTTP Status Code: 429

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: