UIKitSettingsBuilder
UIKitSettingsBuilder is a fluent builder for constructing the UIKitSettings object passed to CometChatUIKit.init().
Methods
All methods are accessed via theCometChatUIKit class.
Init
Initializes the CometChat SDK. Must be called on app startup before any other UIKit method.Replace
APP_ID, REGION, and AUTH_KEY with values from the CometChat Dashboard. Auth Key is optional — use Auth Token for production.Get Logged In User
Checks for an existing session in the SDK. Returns the logged-in user details ornull.
Login using Auth Key
Simple authentication for development/POC. For production, use Auth Token.Login using Auth Token
Production-safe authentication that does not expose the Auth Key in client code.- Create a User via the CometChat API when the user signs up in your app.
- Create an Auth Token via the CometChat API for the new user and save the token in your database.
- Load the Auth Token in your client and pass it to the
loginWithAuthToken()method.
Logout
Ends the current user session.Create User
Takes aUser object and Auth Key, returns the created User object.
Update User
Takes aUser object and Auth Key, returns the updated User object.
Base Message
Text Message
Sends a text message in a 1:1 or group chat. Takes aTextMessage object.
Media Message
Sends a media message in a 1:1 or group chat. Takes aMediaMessage object.
Replace
file with the actual File object.Custom Message
Sends a custom message (neither text nor media) in a 1:1 or group chat. Takes aCustomMessage object.