Skip to main content

ConnectionsClient

The ConnectionsClient provides methods for managing streaming connections, including viewing connection history and terminating active connections.

get_connection_history

Returns active and historical streaming connections with disconnect reasons for the authenticated application.
for page in client.connections.get_connection_history(
    status="active",
    max_results=50,
    connection_fields=["id", "endpoint", "status", "disconnect_reason"]
):
    for connection in page.data:
        print(f"Connection {connection.id}: {connection.status}")
status
str
Filter by connection status. Use ‘active’ for current connections, ‘inactive’ for historical/disconnected connections, or ‘all’ for both.
endpoints
List[str]
Filter by streaming endpoint. Specify one or more endpoint names to filter results.
max_results
int
The maximum number of results to return per page.
pagination_token
str
Token for paginating through results. Use the value from ‘next_token’ in the previous response.
connection_fields
List[str]
A comma separated list of Connection fields to display.
GetConnectionHistoryResponse
Iterator
Iterator that yields pages of connection history. Automatically handles pagination.

delete_by_endpoint

Terminates all streaming connections for a specific endpoint ID for the authenticated application.
response = client.connections.delete_by_endpoint(
    endpoint_id="filtered_stream"
)
endpoint_id
str
required
The endpoint ID to terminate connections for.
DeleteByEndpointResponse
object
Response confirming connections were terminated.

delete_by_uuids

Terminates multiple streaming connections by their UUIDs for the authenticated application.
from xdk.connections.models import DeleteByUuidsRequest

response = client.connections.delete_by_uuids(
    body=DeleteByUuidsRequest(
        uuids=["uuid-1", "uuid-2", "uuid-3"]
    )
)
body
DeleteByUuidsRequest
required
Request body containing the list of connection UUIDs to terminate.
DeleteByUuidsResponse
object
Response confirming connections were terminated.

delete_all

Terminates all active streaming connections for the authenticated application.
response = client.connections.delete_all()
DeleteAllResponse
object
Response confirming all connections were terminated.

Build docs developers (and LLMs) love