CometChat Go Documentation

Welcome Ninja!

You'll find comprehensive guides and documentation to help you start working with CometChat as quickly as possible. Let's jump right in!

Get Started    

Launch CometChat

Launch CometChat

Once you are done with the initialisation and logged in, you can call the below method to launch CometChat.

boolean isFullScreen = true;
var cometchat = DependencyService.Get<CometChatInterface>();

cometchat.launchCometChatWindow(isFullScreen, new LaunchCallbackImplementation(successObj => OnSuccessCall(successObj),             fail => OnFailCall(fail),                                                         onChatroomInfo => OnChatroomInfo(onChatroomInfo),                                 onError => OnError(onError),                                                     onLogout => OnLogout(onLogout),                                                   onMessageReceive => OnMessageReceive(onMessageReceive),                           onUserInfo => OnUserInfo(onUserInfo),                                             onWindowClose => OnWindowClose(onWindowClose)));

Parameters

Info

isFullScreen

Launches CometChat in full screen mode if set to true, else launches CometChat as a popup

LaunchCallbacks

This callback provides you with a set of methods to provide you with information regarding various events related to CometChat. For more information regarding the methods please click here

Launch Private or Group Chat

If you do not wish to launch the entire CometChat UI, you can launch an individual private chat or group chat.

private boolean isFullScreen = true;
private String userOrGroupId = "1"
private boolean isGroup = false;
private boolean setBackButton = false;

var cometchat = DependencyService.Get<CometChatInterface>();

cometchat.launchCometChatWithId(isFullScreen,userOrGroupId,isGroup,setBackButton, new LaunchCallbackImplementation(successObj => OnSuccessCall(successObj),             fail => OnFailCall(fail),                                                         onChatroomInfo => OnChatroomInfo(onChatroomInfo),                                 onError => OnError(onError),                                                     onLogout => OnLogout(onLogout),                                                   onMessageReceive => OnMessageReceive(onMessageReceive),                           onUserInfo => OnUserInfo(onUserInfo),                                             onWindowClose => OnWindowClose(onWindowClose)));

Parameters

Info

isFullScreen

Launches CometChat in full screen mode if set to true, else launches CometChat as a popup

userOrGroupId

UID of the user or GUID of the group you wish to launch the chat window for.

isGroup

set to true if you wish to launch a group chat window. If you wish to launch a chat window for a user, set it to false.

setBackButton

If set to true, on close of the chat window you will be navigated to your app.When set to false you will be taken to the CometChat home screen where you can see the user and group lists.

LaunchCallbacks

This callback provides you with a set of methods to provide you with information regarding various events related to CometChat. For more information regarding the methods please read below :point-down:

Launch Callbacks

Method

Info

successCallback

This method is triggered once the request to launch CometChat is executed successfully

failCallback

This is triggered when some issue is encountered while launching CometChat

userInfoCallback

This method is invoked when the user data is fetched from the server.

chatroomInfoCallback

This method is triggered when the chatroom details are fetched by the server.

onMessageReceive

Any message received from the server triggers this method.

onWindowClose

This callback method is invoked when the chat window is closed.

onLogout

This callback method is invoked when the user logs out of the app.

Updated 2 years ago

Launch CometChat


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.