:doc:`IoTDataPlane <../../iot-data>` / Client / delete_connection

*****************
delete_connection
*****************



.. py:method:: IoTDataPlane.Client.delete_connection(**kwargs)

  

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

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-data-2015-05-28/DeleteConnection>`_  


  **Request Syntax**
  ::

    response = client.delete_connection(
        clientId='string',
        cleanSession=True|False,
        preventWillMessage=True|False
    )
    
  :type clientId: string
  :param clientId: **[REQUIRED]** 

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

    

  
  :type cleanSession: boolean
  :param cleanSession: 

    Specifies whether to remove the client's 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. By default, this is set to ``FALSE`` (preserves the session state).

    

  
  :type preventWillMessage: boolean
  :param preventWillMessage: 

    Controls if Amazon Web Services 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 allow publishing. By default, this is set to ``FALSE`` (allows publishing the LWT message).

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`IoTDataPlane.Client.exceptions.ForbiddenException`

  
  *   :py:class:`IoTDataPlane.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoTDataPlane.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoTDataPlane.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoTDataPlane.Client.exceptions.InternalFailureException`

  