Documentation Index
Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
disconnected → connecting → connected.
Connection States
| Value | Callback | Description |
|---|---|---|
CometChatWSState.connected | onConnected() | SDK has an active connection to CometChat servers |
CometChatWSState.connecting | onConnecting() | SDK is attempting to establish or re-establish a connection |
CometChatWSState.disconnected | onDisconnected() | SDK is disconnected due to network issues or other errors |
CometChatWSState.featureThrottled | onFeatureThrottled() | A feature has been throttled to prevent performance loss |
| — | onConnectionError(CometChatException) | An error occurred while maintaining the connection |
Get Current Status
UsegetConnectionStatus() to check the current connection state at any time:
- Dart
CometChatWSState.connected(connected)CometChatWSState.connecting(connecting)CometChatWSState.disconnected(disconnected)CometChatWSState.featureThrottled(featureThrottled)
Listen for Connection Changes
Register aConnectionListener to receive real-time connection state updates. We recommend adding this on app startup after CometChat.init() completes.
ConnectionListener Events
| Event | Parameter | Description |
|---|---|---|
onConnected() | — | Triggered when the SDK successfully establishes a connection to the WebSocket server |
onConnecting() | — | Triggered when the SDK is attempting to establish a connection to the WebSocket server |
onDisconnected() | — | Triggered when the SDK gets disconnected due to network fluctuations or other issues |
onFeatureThrottled() | — | Triggered when CometChat automatically toggles off certain features to prevent performance loss |
onConnectionError(CometChatException error) | CometChatException | Triggered when an error occurs while maintaining the WebSocket connection |
- Dart
Remove Connection Listener
Know more about CometChat SDK connection behaviour click here
Next Steps
Connection Behaviour
Understand how CometChat SDK manages WebSocket connections
Login Listeners
Monitor user login and logout events in real-time
All Real-Time Listeners
Complete reference for all SDK listeners
Setup SDK
Install and initialize the CometChat SDK