This section documents the Angular services provided by the CometChat UIKit. These are injectable services you use via Angular’s dependency injection to manage state, configure components, and customize behavior.Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Core Classes
CometChatUIKit
The main entry point for initializing and configuring the UIKit.The UIKit exposes two session-check methods with intentionally different casing — this mirrors the underlying CometChat SDK naming.
getLoggedInUser()(capital I, synchronous) — returns the in-memory cached user immediately. Use this for quick checks inside components where you already know the user is logged in.getLoggedinUser()(lowercase i, async) — makes an SDK call to verify the session. Use this inngOnInitormain.tsbefore rendering components, as it is the authoritative check.
UIKitSettings
Build settings usingUIKitSettingsBuilder:
UIKitSettingsBuilder Methods
| Method | Type | Default | Description |
|---|---|---|---|
setAppId(appId) | string | — | Your CometChat App ID (required) |
setRegion(region) | string | — | Your CometChat region, e.g. 'us', 'eu', 'in' (required) |
setAuthKey(authKey) | string | — | Auth Key for development. Use Auth Token in production |
subscribePresenceForAllUsers() | — | — | Subscribe to presence updates for all users |
subscribePresenceForFriends() | — | — | Subscribe to presence updates for friends only |
subscribePresenceForRoles(roles) | string[] | — | Subscribe to presence updates for specific roles |
setAutoEstablishSocketConnection(auto) | boolean | true | Auto-establish WebSocket connection on init |
setCallingEnabled(enabled) | boolean | false | Enable voice/video calling. When true, the Calls SDK is initialized after login and call buttons become visible in MessageHeader, CallButtons, and CallLogs. When false (default), call buttons are hidden and the Calls SDK is not initialized |
setCallAppSettings(settings) | any | — | Custom CallAppSettings for the Calls SDK. Built via CometChatUIKitCalls.CallAppSettingsBuilder. If not set, the UIKit builds default settings from appId and region |
setStorageMode(mode) | CometChat.StorageMode | LOCAL | Storage mode for the SDK |
setAdminHost(host) | string | — | Override the admin host URL |
setClientHost(host) | string | — | Override the client host URL |
setCallingEnabled(true) requires @cometchat/calls-sdk-javascript to be installed. Without the Calls SDK package, calling features will not activate even when enabled.Services
Documented Services
| Service | Description | Reference |
|---|---|---|
| ChatStateService | Centralized chat state management service — tracks active user, group, and conversation across components | ChatStateService |
| MessageBubbleConfigService | Centralized message bubble view configuration — customize bubble parts globally or per message type | MessageBubbleConfigService |
| CometChatTemplatesService | SDK-wide template customization service — shared and component-specific templates for all list components | CometChatTemplatesService |
| FormatterConfigService | Text formatter configuration service — manages text formatting rules and custom formatters | FormatterConfigService |
| RichTextEditorService | Rich text editor configuration service — controls editor behavior, toolbar options, and input modes | RichTextEditorService |
| GlobalConfig | Centralized configuration via COMETCHAT_GLOBAL_CONFIG injection token — sets defaults for display, sound, calls, and more across all components | GlobalConfig |
Service Scoping (Multiple Instances)
Most customization services (MessageBubbleConfigService, FormatterConfigService, CometChatTemplatesService, RichTextEditorService) are provided at the root level as singletons. This means all component instances share the same configuration by default.
If you need different configurations for different component instances (e.g., a main chat panel and a thread panel with different bubble styles), you can scope a service to a wrapper component by adding it to the component’s providers array. Angular’s hierarchical dependency injection will give that component and its children their own service instance.