CometChatUIKit
class. This class provides access to all the public methods exposed by the CometChat UI Kit.
Auth Key
is an optional property of the UIKitSettings
Class. It is intended for use primarily during proof-of-concept (POC) development or in the early stages of application development. You can use the Auth Token to log in securely.UIKitSettings
is an important parameter of the init()
function. It functions as a base settings object, housing properties such as appId
, region
, and authKey
, contained within UIKitSettings
.
Here’s the table format for the properties available in UIKitSettings
:
Method | Type | Description |
---|---|---|
setAppId | String | Sets the unique ID for the app, available on dashboard |
setRegion | String | Sets the region for the app (‘us’ or ‘eu’) |
setAuthKey | String | Sets the auth key for the app, available on dashboard |
subscribePresenceForAllUsers | String | Sets subscription type for tracking the presence of all users |
subscribePresenceForFriends | String | Sets subscription type for tracking the presence of friends |
subscribePresenceForRoles | String | Sets subscription type for tracking the presence of users with specified roles |
setAutoEstablishSocketConnection | Boolean | Configures if web socket connections will established automatically on app initialization or be done manually, set to true by default |
setAIFeatures | List<AIExtensionDataSource> | Sets the AI Features that need to be added in UI Kit |
setExtensions | List<ExtensionsDataSource> | Sets the list of extension that need to be added in UI Kit |
UID
of a user is needed to log in. This simple authentication procedure is useful when you are creating a POC or if you are in the development phase. For production apps, we suggest you use AuthToken instead of Auth Key.
loginWithAuthToken()
method.
.logout()
function
.createUser()
function. This can be extremely useful for situations where users are registered or authenticated by your system and then need to be created on CometChat.
sendMessage()
function. This function requires a TextMessage
object as its argument, which contains the necessary information for delivering the message.
It’s essential to understand the difference betweenThe concluding code block:CometChatUIKit.sendTextMessage()
andCometChat.sendTextMessage()
. When you useCometChatUIKit.sendTextMessage()
, it automatically adds the message to the MessagesComponent and ConversationsComponent, taking care of all related cases for you. On the other hand,CometChat.sendTextMessage()
only sends the message and doesn’t automatically update these components in the UI Kit.
sendMediaMessage()
function. This function requires a MediaMessage
object as its argument, which contains the necessary information for delivering the message.
It’s essential to understand the difference betweenThe concluding code block:CometChatUIKit.sendMediaMessage()
andCometChat.sendMediaMessage()
. When you useCometChatUIKit.sendMediaMessage()
, it automatically adds the message to the MessagesComponent and ConversationsComponent, taking care of all related cases for you. On the other hand,CometChat.sendMediaMessage()
only sends the message and doesn’t automatically update these components in the UI Kit.
sendCustomMessage()
function. This function requires a CustomMessage
object as its argument, which contains the necessary information for delivering the message.
It’s essential to understand the difference betweenThe concluding code block:CometChatUIKit.sendCustomMessage()
andCometChat.sendCustomMessage()
. When you useCometChatUIKit.sendCustomMessage()
, it automatically adds the message to the MessagesComponent and ConversationsComponent, taking care of all related cases for you. On the other hand,CometChat.sendCustomMessage()
only sends the message and doesn’t automatically update these components in the UI Kit.
Note: To display custom messages in the MessageList, you must create and register a new MessageTemplate that defines how to render your custom message type.
sendFormMessage()
function. This function requires a FormMessage
object as its argument, which contains the necessary information to create a form bubble for that messages
sendCardMessage()
function. This function requires a CardMessage
object as its argument, which contains the necessary information to create a card bubble for the messages
sendCardMessage()
function. This function requires a SchedulerMessage
object as its argument, which contains the necessary information to create a SchedulerMessage bubble for the messages
sendCustomInteractiveMessage()
function. This function requires a CustomInteractiveMessage
object as its argument.
Note: To display custom messages in the MessageList, you must create and register a new MessageTemplate that defines how to render your custom message type.s