CometChatUIKit
is a class that contains all necessary methods to help initialize the CometChat SDK with valid credentials for the ui kit to utilize.
The following properties and methods are present:
Parameters | Type | Description |
---|---|---|
init | static init(uiKitSettings: UIKitSettings): Promise<boolean> | method initializes the settings required for CometChat SDK. First, ensure authSettings is set and then call the init() method on app startup |
login | static async login({ uid, authToken }: { uid?: string, authToken?: string }): Promise<CometChat.User> | used for logging in with credentials but use this function only for testing purpose |
logout | static logout(): Promise<Object> | used for ending user session of logged in user |
createUser | static createUser( user: CometChat.User): Promise<CometChat.User> | used for creating new user |
updateUser | static updateUser(user: CometChat.User): Promise<CometChat.User> { | used for updating user object |
sendCustomMessage | static sendCustomMessage(message: CometChat.CustomMessage, onSuccess?: (msg: CometChat.CustomMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void): void | can be used to send a custom message |
sendTextMessage | static sendTextMessage(message: CometChat.TextMessage, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void): void | can be used to send a text message |
sendMediaMessage | static sendMediaMessage(message: CometChat.CustomMessage, onSuccess?: (msg: CometChat.MediaMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void): void | can be used to send a media message |
sendFormMessage | static sendFormMessage(message: FormMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> | can be used to send a form message. disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false. |
sendCardMessage | static sendCardMessage(message: CardMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> | can be used to send a card message. disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false. |
sendCustomInteractiveMessage | static sendCustomInteractiveMessage(message: CustomInteractiveMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> | can be used to send a custom interactive message. disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false. |
Properties | Type | Description |
---|---|---|
appId | string | the unique ID for the app, available on dashboard |
region | string | the region for the app us or eu |
authKey | string | the auth key for the app, available on dashboard |
subscriptionType | string | sets user presence subscription for all users |
autoEstablishSocketConnection | Bool | configure if web socket connections will established automatically on app initialization or be done manually, set to true by default |
disableCalling | boolean | disable calling |
overrideAdminHost | string | used to set the admin host |
overrideClientHost | string | used to set the client host |
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 method to log in securely.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.
login({authToken: authToken})
method.update(user: User)
method