Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pion/ice/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheConnectionState enum represents the state of an ICE connection as defined in RFC 5245. The agent transitions through these states as it establishes and maintains a peer-to-peer connection.
Type Definition
States
ConnectionStateNew
ConnectionStateChecking
ConnectionStateConnected
ConnectionStateCompleted
In practice, most implementations transition directly from
Connected to other states without using Completed.ConnectionStateFailed
ConnectionStateDisconnected
ConnectionStateClosed
ConnectionStateUnknown
Methods
String
"New"for ConnectionStateNew"Checking"for ConnectionStateChecking"Connected"for ConnectionStateConnected"Completed"for ConnectionStateCompleted"Failed"for ConnectionStateFailed"Disconnected"for ConnectionStateDisconnected"Closed"for ConnectionStateClosed"Invalid"for unknown states
State Transitions
Common Transitions:- New → Checking: When remote credentials are set and connectivity checks begin
- Checking → Connected: When a candidate pair succeeds
- Connected → Disconnected: When no packets received within
DisconnectedTimeout - Disconnected → Connected: When connectivity is restored
- Disconnected → Failed: When disconnected for longer than
FailedTimeout - Checking → Failed: When all pairs fail or checking times out
- Any → Closed: When
Close()orGracefulClose()is called
Usage Example
Timeout Configuration
You can configure state transition timeouts:- DisconnectedTimeout: 5 seconds
- FailedTimeout: 25 seconds (after disconnected)
Setting a timeout to
0 disables that state transition.Related
- Agent - ICE Agent with state management
- GatheringState - Candidate gathering state