# amazon-connect/amazon-connect-chat-ios architecture

> Architecture diagram of the GitHub repository amazon-connect/amazon-connect-chat-ios, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amazon-connect/amazon-connect-chat-ios
- Repository: https://github.com/amazon-connect/amazon-connect-chat-ios

## Overview

Amazon Connect Chat SDK for iOS manages a chat session and its client-side communications; the integrating app’s backend must first initiate the contact and provide the resulting chat details. The principal flow is app → ChatSession → ChatService, which establishes the participant connection and WebSocket, then exposes transcript updates and chat actions. Separate capabilities include attachments, receipts, lifecycle events, and metrics. The tree identifies additional network and model modules, but their detailed wiring is not shown in the sampled source, so those links are limited to documented or directly evidenced relationships.

Main entry points: [`Sources/Core/Service/ChatService.swift`](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Service/ChatService.swift) (ChatService), [`Sources/Core/Network/WebSocketManager.swift`](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/WebSocketManager.swift) (WebSocket manager), [`Sources/Core/Service/ChatSession.swift`](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Service/ChatSession.swift) (ChatSession), [`Sources/Core/Network/AWSClient.swift`](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/AWSClient.swift) (Participant client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Session API"]
  node_chat_session["ChatSession<br/>[ChatSession.swift]"]
  node_chat_service["ChatService<br/>[ChatService.swift]"]
  node_config["Global configuration<br/>[GlobalConfig.swift]"]
  node_connection_details["Connection details"]
  node_chat_details["Chat details<br/>[ChatDetails.swift]"]
end

subgraph group_chat["Chat capabilities"]
  node_transcript["Transcript handling"]
  node_message["Messages and events<br/>[Message.swift]"]
  node_receipts["Receipt batching"]
  node_attachment["Attachment types"]
end

subgraph group_transport["Connections"]
  node_aws_client["Participant client<br/>[AWSClient.swift]"]
  node_aws_adapter["Participant adapter"]
  node_websocket["WebSocket manager"]
  node_heartbeat["Heartbeat manager"]
  node_network["Network manager"]
end

subgraph group_support["Shared support"]
  node_metrics_manager["Metrics manager"]
  node_api_client["API client<br/>[APIClient.swift]"]
  node_logger["SDK logger<br/>[SDKLogger.swift]"]
end

node_app(("Integrating app"))
node_backend(("Chat backend"))
node_participant(("Participant service"))

node_backend -->|"provides chat details"| node_app
node_app -->|"configures and uses"| node_chat_session
node_chat_session -->|"delegates chat actions"| node_chat_service
node_chat_service -->|"creates participant connection"| node_aws_client
node_aws_client -->|"calls participant APIs"| node_participant
node_chat_service -->|"sets up session transport"| node_websocket
node_websocket -->|"starts heartbeats"| node_heartbeat
node_websocket -->|"observes connectivity"| node_network
node_websocket -->|"requests refreshed connection"| node_chat_service
node_chat_service -->|"batches receipts"| node_receipts
node_chat_service -->|"publishes transcript items"| node_transcript
node_chat_service -->|"handles messages and events"| node_message
node_chat_service -->|"supports attachment exchange"| node_attachment
node_metrics_manager -->|"sends metrics"| node_api_client
node_chat_session -->|"accepts configuration"| node_config
node_chat_service -->|"uses session details"| node_chat_details
node_aws_client -->|"uses participant adapter"| node_aws_adapter

click node_chat_session "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Service/ChatSession.swift"
click node_chat_service "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Service/ChatService.swift"
click node_config "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/GlobalConfig.swift"
click node_connection_details "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/ConnectionDetails.swift"
click node_chat_details "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/ChatDetails.swift"
click node_transcript "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/TranscriptItem.swift"
click node_message "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/Message.swift"
click node_receipts "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/MessageReceiptsManager.swift"
click node_attachment "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/AttachmentTypes.swift"
click node_aws_client "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/AWSClient.swift"
click node_aws_adapter "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/AWSConnectParticipantAdapter.swift"
click node_websocket "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/WebSocketManager.swift"
click node_heartbeat "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/HeartbeatManager.swift"
click node_network "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/NetworkConnectionManager.swift"
click node_metrics_manager "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/MetricsManager.swift"
click node_api_client "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/APIClient.swift"
click node_logger "https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Utils/Logger/SDKLogger.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chat_session,node_chat_service,node_config,node_connection_details,node_chat_details toneBlue
class node_transcript,node_message,node_receipts,node_attachment toneAmber
class node_aws_client,node_aws_adapter,node_websocket,node_heartbeat,node_network toneMint
class node_metrics_manager,node_api_client,node_logger toneRose
class node_app,node_backend,node_participant toneIndigo
```

## Components

### Session API

- [ChatSession](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Service/ChatSession.swift): `Sources/Core/Service/ChatSession.swift`
- [ChatService](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Service/ChatService.swift): `Sources/Core/Service/ChatService.swift`
- [Global configuration](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/GlobalConfig.swift): `Sources/Core/Models/GlobalConfig.swift`
- [Connection details](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/ConnectionDetails.swift): `Sources/Core/Models/ConnectionDetails.swift`
- [Chat details](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/ChatDetails.swift): `Sources/Core/Models/ChatDetails.swift`

### Chat capabilities

- [Transcript handling](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/TranscriptItem.swift): `Sources/Core/Models/TranscriptItem.swift`
- [Messages and events](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/Message.swift): `Sources/Core/Models/Message.swift`
- [Receipt batching](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/MessageReceiptsManager.swift): `Sources/Core/Network/MessageReceiptsManager.swift`
- [Attachment types](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Models/AttachmentTypes.swift): `Sources/Core/Models/AttachmentTypes.swift`

### Connections

- [Participant client](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/AWSClient.swift): `Sources/Core/Network/AWSClient.swift`
- [Participant adapter](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/AWSConnectParticipantAdapter.swift): `Sources/Core/Network/AWSConnectParticipantAdapter.swift`
- [WebSocket manager](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/WebSocketManager.swift): `Sources/Core/Network/WebSocketManager.swift`
- [Heartbeat manager](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/HeartbeatManager.swift): `Sources/Core/Network/HeartbeatManager.swift`
- [Network manager](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/NetworkConnectionManager.swift): `Sources/Core/Network/NetworkConnectionManager.swift`

### Shared support

- [Metrics manager](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/MetricsManager.swift): `Sources/Core/Network/MetricsManager.swift`
- [API client](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Network/APIClient.swift): `Sources/Core/Network/APIClient.swift`
- [SDK logger](https://github.com/amazon-connect/amazon-connect-chat-ios/blob/main/Sources/Core/Utils/Logger/SDKLogger.swift): `Sources/Core/Utils/Logger/SDKLogger.swift`

### Other components

- **Integrating app**
- **Chat backend**
- **Participant service**

## Connections

- Chat backend → Integrating app: provides chat details
- Integrating app → ChatSession: configures and uses
- ChatSession → ChatService: delegates chat actions
- ChatService → Participant client: creates participant connection
- Participant client → Participant service: calls participant APIs
- ChatService → WebSocket manager: sets up session transport
- WebSocket manager → Heartbeat manager: starts heartbeats
- WebSocket manager → Network manager: observes connectivity
- WebSocket manager → ChatService: requests refreshed connection
- ChatService → Receipt batching: batches receipts
- ChatService → Transcript handling: publishes transcript items
- ChatService → Messages and events: handles messages and events
- ChatService → Attachment types: supports attachment exchange
- Metrics manager → API client: sends metrics
- ChatSession → Global configuration: accepts configuration
- ChatService → Chat details: uses session details
- Participant client → Participant adapter: uses participant adapter
