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
trueto include socket information. Set tofalseto omit socket information. By default, this is set tofalse.
- 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
UNKNOWNfor 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
truefor 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.InvalidRequestExceptionIoT.Client.exceptions.ThrottlingExceptionIoT.Client.exceptions.UnauthorizedExceptionIoT.Client.exceptions.ServiceUnavailableExceptionIoT.Client.exceptions.InternalFailureExceptionIoT.Client.exceptions.ResourceNotFoundExceptionIoT.Client.exceptions.IndexNotReadyException