AI Integration Quick Reference
AI Integration Quick Reference
ConnectionListener to monitor real-time WebSocket connection state. The SDK automatically attempts to reconnect when disconnected.
| Callback | Description |
|---|---|
onConnecting | SDK is attempting to establish a WebSocket connection |
onConnected | Connection successfully established |
onDisconnected | Connection lost (network fluctuation, etc.) |
onFeatureThrottled | CometChat toggled off certain features to prevent performance loss |
CometChatException with details about the connection failure.
- Java
- Kotlin
Get Current Status
UsegetConnectionStatus() to check the current connection state at any time:
- Java
- Kotlin
| Value | Description |
|---|---|
CometChatConstants.WS_STATE_CONNECTED | Active connection |
CometChatConstants.WS_STATE_CONNECTING | Attempting to connect |
CometChatConstants.WS_STATE_DISCONNECTED | No connection |
CometChatConstants.WS_STATE_FEATURE_THROTTLED | Feature throttled |
Know more about CometChat SDK connection behaviour click here
Next Steps
Connection Behaviour
Learn about SDK connection behavior and reconnection logic
Setup
Initialize the SDK and establish connection
User Presence
Track user online/offline status
Real-Time Listeners
Register listeners for messages, users, groups, and calls