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
:
Method | Type | Description |
---|---|---|
set(appID:) | String | Sets the unique ID for the app, available on dashboard |
set(region:) | String | Sets the region for the app (‘us’ or ‘eu’) |
set(authKey:) | 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.
The concluding code block:
login(authToken:)
method..logout(user:)
function.
The concluding code block:
.create(user:)
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.
The concluding code block:
sendTextMessage()
function. This function requires a TextMessage
object as its argument, which contains the necessary information for delivering the message.
The concluding code block:
It’s essential to understand the difference betweenCometChatUIKit.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.
The concluding code block:
It’s essential to understand the difference betweenCometChatUIKit.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.
The concluding code block:
It’s essential to understand the difference betweenCometChatUIKit.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.
sendFormMessage()
function. This function requires a FormMessage
object as its argument, which contains the necessary information to create a form bubble for that messages
The concluding code block:
sendCardMessage()
function. This function requires a CardMessage
object as its argument, which contains the necessary information to create a card bubble for the messages.
The concluding code block:
sendSchedulerMessage()
function. This function requires a SchedulerMessage
object as its argument, which contains the necessary information to create a SchedulerMessage bubble for the messages.
The concluding code block: