IoT / Client / get_thing_connectivity_data

get_thing_connectivity_data

IoT.Client.get_thing_connectivity_data(**kwargs)

Retrieves the live connectivity status per device.

See also: AWS API Documentation

Request Syntax

response = client.get_thing_connectivity_data(
    thingName='string',
    includeSocketInformation=True|False
)
Parameters:
  • thingName (string) –

    [REQUIRED]

    The name of your IoT thing.

  • includeSocketInformation (boolean) – Specifies if socket information (sourcePort, targetPort, sourceIp, targetIp, vpcEndpointId) should be included in the GetThingConnectivityData response. Set to true to include socket information. Set to false to omit socket information. By default, this is set to false.

Return type:

dict

Returns:

Response Syntax

{
    'thingName': 'string',
    'connected': True|False,
    'timestamp': datetime(2015, 1, 1),
    'disconnectReason': 'AUTH_ERROR'|'CLIENT_INITIATED_DISCONNECT'|'CLIENT_ERROR'|'CONNECTION_LOST'|'DUPLICATE_CLIENTID'|'FORBIDDEN_ACCESS'|'MQTT_KEEP_ALIVE_TIMEOUT'|'SERVER_ERROR'|'SERVER_INITIATED_DISCONNECT'|'API_INITIATED_DISCONNECT'|'THROTTLED'|'WEBSOCKET_TTL_EXPIRATION'|'CUSTOMAUTH_TTL_EXPIRATION'|'UNKNOWN'|'NONE',
    'sourceIp': 'string',
    'sourcePort': 123,
    'targetIp': 'string',
    'targetPort': 123,
    'vpcEndpointId': 'string',
    'keepAliveDuration': 123,
    'cleanSession': True|False,
    'sessionExpiry': 123,
    'clientId': 'string'
}

Response Structure

  • (dict) –

    • thingName (string) –

      The name of your IoT thing.

    • connected (boolean) –

      A Boolean that indicates the connectivity status.

    • timestamp (datetime) –

      The timestamp of when the event occurred. When you enable or update the indexing configuration, this value might be the Unix epoch time (0) for devices that have never connected or have been disconnected for more than an hour.

    • disconnectReason (string) –

      The reason why the client is disconnecting. When you enable or update the indexing configuration, this value might be UNKNOWN for devices that have never connected or have been disconnected for more than an hour.

    • sourceIp (string) –

      The IP address of the client that initiated the connection.

    • sourcePort (integer) –

      The client’s source port.

    • targetIp (string) –

      The IP address of the Amazon Web Services IoT Core endpoint that the client connected to.

    • targetPort (integer) –

      The port number of the Amazon Web Services IoT Core endpoint that the client connected to.

    • vpcEndpointId (string) –

      The ID of the VPC endpoint. Present for clients connected to Amazon Web Services IoT Core via a VPC endpoint.

    • keepAliveDuration (integer) –

      The keep-alive interval in seconds that the client specified when establishing the connection.

    • cleanSession (boolean) –

      Indicates whether the client is using a clean session. Returns true for clean sessions.

    • sessionExpiry (integer) –

      The session expiry interval in seconds for the MQTT client connection. This value indicates how long the session will remain active after the client disconnects.

    • clientId (string) –

      The unique identifier of the MQTT client.

Exceptions

  • IoT.Client.exceptions.InvalidRequestException

  • IoT.Client.exceptions.ThrottlingException

  • IoT.Client.exceptions.UnauthorizedException

  • IoT.Client.exceptions.ServiceUnavailableException

  • IoT.Client.exceptions.InternalFailureException

  • IoT.Client.exceptions.ResourceNotFoundException

  • IoT.Client.exceptions.IndexNotReadyException