Skip to main content

Connection Management

ART provides sophisticated connection management with automatic failover, reconnection strategies, and multiple transport protocols. The Swift ADK handles connection complexity transparently while giving you control over connection lifecycle and monitoring.

Connection States

ART maintains four distinct connection states that you can monitor and respond to:

  • connected - Active real-time connection
  • retrying - Attempting to reconnect after failure
  • paused - Manually paused by user
  • stopped - Connection terminated or max retries reached
// Initiate the connection to the ART server
[adk connect:nil completion:^{
NSLog(@"Connection established");
}];

// Monitor connection state
NSString *currentState = [adk getState];
NSLog(@"Connection state: %@", currentState);

Manual Lifecycle Control

// Pause: close the socket but keep subscriptions for later resume
adk.pause()

// Resume: re-open the socket
await adk.resume()

// Disconnect: full teardown, clears subscriptions and connection state
await adk.disconnect()
MethodWhen to use
connect()Initial connection or after disconnect()
pause()Temporarily stop (e.g., app backgrounded)
resume()Bring a paused connection back online
disconnect()Full teardown — releases all resources
getState()Read the current state synchronously

Message Buffering and Privacy

ART implements a privacy-first approach to message handling with selective buffering based on connection states and channel types.

  • Sender-Side Message Buffering: When a sender goes offline before message delivery, the ADK buffers messages locally and delivers them upon reconnection.
  • Receiver-Side Message Loss: ART does not store messages server-side to protect user privacy. If a receiver is offline when messages are sent, those messages are permanently lost.

ART's message loss behavior is intentional and provides several privacy benefits:

  • No Server Storage: Messages are never stored on ART servers
  • Complete Privacy: No message history can be accessed or compromised
  • Real-time Only: Communication is truly ephemeral
  • Data Protection: Complies with strict privacy regulations

This privacy-first approach ensures that ART provides secure, ephemeral communication while giving you options for critical message delivery when needed.

tip

To ensure messages are delivered regardless, enable guaranteed message delivery for the channel at creation time from the ART Dashboard.

important

Guaranteed message delivery is available only for Targeted and Encrypted Channel types.