Applozic to CometChat Migration

Applozic recently announced that they’ll be shutting down their services in April, so start your migration to CometChat today through this step-by-step migration guide.

Aditya Gokula • Mar 25, 2022

Applozic announced this week that they’ll be completely shutting down their services in April. It's a tough time for Applozic customers who are in a rush to migrate to other services, given the tight timeframe and concerns over data loss. However, the CometChat team is here to help ease the transition through this step-by-step migration guide. Let's dive right in!

A Brief Comparison between Applozic & CometChat

The following section highlights key differences between the Android client implementation of Applozic and CometChat.

Init

Applozic SDK can be initailized using the init() function provided by the SDK.

For CometChat, the SDK provides the init() method which takes the app ID , REGION, and along with the app id, takes a few additional parameters that determines certain settings for the SDK to function.

For more information on the same, you can check here.

User Creation

Both Applozic and CometChat provide APIs to create user and options, which, in turn, create and update users from the frontends via the SDKs.

On the frontend, Applozic does not provide an explicit method to create users. iIt is done via the same connect method which helps the user to log in. If the user is not present, the method will create the user and log the user in.

In CometChat, there are separate methods for user management and login.

Additional data can be added to user object for both CometChat and Applozic via the metadata field.

Authentication

Applozic provides two modes for authentication

  1. Username and Password

  2. Access token

Username and Password

In this mechanism, while creating the users, the password needs to be specified and the authenticationType needs to be set as:

User.AuthenticationType.APPLOZIC.getValue()

And this password needs to be provided every time the user logs in. The password field can be set blank in this case (recommended for testing purposes). Option to update the password is also available.

Access Token

In this method, the access token for Applozic needs to be passed to the frontend after being generated at the server. Later, this access token needs to be set as the password for the user. In this case, the authenticationType needs to be set as User.AuthenticationType.CLIENT.getValue(). From the dashboard, the security settings needs to be enabled and a URL to validate this access token needs to be provided. While logging in, the Applozic server will ask for validation from the URL and if the URL returns true, the user will be allowed to log in.

screenshot at am

CometChat provides two options for Authentication:

  1. Login with UID and AuthKey

In this method, the API key needs to be provided and the SDK internally generates an authToken for the user and then logs the user in using the authToken generated.

  1. Login with authToken

In this case, you need to generate the authToken using the Rest API and pass this token to the front-end where this token will be used to login to the SDK.

For more information on the same, you can check out this documentation.

Conversations

In Applozic, the ApplozicConversation.getLatestMessageList method returns the List of Messages based on the timestamp. This will return only the last messages for the latest conversations in the descending order. The data for the user/group to which the conversation belongs needs to be fetched from the message information and the conversation list needs to be displayed in a paginated manner.

The unread count for the conversations needs to be fetched separately by using either of the below methods:

Individual user conversation unread count -

new MessageDatabaseService(context).getUnreadMessageCountForContact(userId)

Individual group conversation unread count -

new MessageDatabaseService(context).getUnreadMessageCountForChannel(channelKey);

Total Unread Count for all conversations -

new MessageDatabaseService(context).getTotalUnreadCount();

While in CometChat, the SDK provides the ConversationsRequest class, which helps the developers fetch the latest conversations for the user logged in. In CometChat, the SDK returns a list of conversation objects which consists of the following information:

  1. conversationId - Id for the conversation.

  2. conversationWith - Id of the user/group for which the conversation is created.

  3. conversationType - Type of the conversation(user/group).

  4. lastMessage - Message object for the last message of the conversation.

  5. unreadMessageCount - The number if unread messages for the conversation.

  6. tags - List of tags the conversation has been tagged with.

This can be used to display the list of conversations in a paginated manner. For more information on this you can checkout the docs here.

Users

Both Applozic and CometChat need users to be created on their platforms. Both provide APIs and SDK methods to achieve the same. Likewise, they provide the option to fetch the list of all the users available in a paginated manner. But CometChat provides certain additional filters like fetching users based on roles, user status(online/offline), tags, searchKeyword, etc.

Applozic code to fetch registered users:

For CometChat:

For more information on the CometChat Users, you can refer to the documentation here.

Applozic has a concept of Contacts which are basically users created locally on the device that can be used to display a specific set of users based on the use case. You can also create a group of users (Same as groups in CometChat), which can be used to group users based on common interest.

CometChat allows tagging of users using which the above scenarios can be achieved. CometChat also provides an option to fetch users belonging to specific tags

Groups

Both Applozic and CometChat have the concept of groups and are used in the same manner, i.e. allowing multiple users to chat amongst themselves.

Types of Groups in Applozic

Scopes of Group Members in Applozic

Group-Related Operations

1. Create a Group

Applozic: While creating a group, you can specify the id, name, and other details of the group, including the metadata stating the properties of the group.

CometChat: While creating a group in CometChat, you need to specify the below details

  1. GUID - ID of the group.

  2. name - Name of the group.

  3. type - type of the group.

  4. password - Password for the group in case the type of the group is password.

  5. icon - Group icon URL (Optional).

  6. description - Group description (Optional).

Additional metadata can be added for the group in case some extra information related to the group needs to be saved.

For more information on this, please refer to the documentation here.

2. Add Members to Group

Applozic: In Applozic, you can add members while creating the group and the SDK also provides separate method to add the members to a group.

CometChat: In CometChat, all we need to do is provide a List of Groupmember objects that informs the SDK which users are to be added to the group with the specified GUID and the scopes with which the users are to be added to the group.

For more information on this you can refer to the documentation here.

3. Remove Members from Group

Applozic: In the case of Applozic, the admins of the groups can remove any member from the group using the code below.

CometChat: CometChat provides 2 options to remove the users from the group.

‍**-** Kick the User: In this case, the user is free to join the group again.

- Ban the User**:** In this case, the user cannot join the same group unless he is unbanned from the group.

For more information on this, please refer to the documentation here.

4. Join Group

Applozic: There is not a separate method to join a group. You need to use the add members method to make a user join any group.

CometChat: In CometChat, you need to use the joinGroup() method provided by the SDK to join a public or a password-enabled group.

For more information on this, please refer to the documentation here.

5. Get List of Groups

Applozic: Getting a list of all the groups for the logged in user is not available via the SDK and needs to be done using the Rest APIs.

CometChat: In order to get the list of groups available for the logged in user, you need to use the GroupsRequest class provided by the SDK which helps you fetch all the groups for the logged in user in a paginated manner.

For more information on this, please refer to the documentation here.

6. Leave Group

Applozic: The logged in user can leave a group using the code snippet as shown below.

CometChat: With CometChat, a member of the group can leave the group by using the leaveGroup() method provided by the SDK.

For more information on this, please refer to the documentation here.

7. Update Group Details

Applozic: The Applozic SDK only allows modifying the name of the group via the SDK. For updating the other details like icon, settings, etc., you will need to use the Rest API. You can update the name of the group by using the below code snippet.

CometChat: The CometChat SDK allows editing the groups using the updateGroup() method of the SDK. Only admins and moderators can edit the group details in CometChat.

For more information on this, please refer to the documentation here.

8. Get Group Details

Applozic: The Applozic SDK stores the group information in the local database of the device and returns the data from the local database itself.

CometChat: The CometChat SDK provides the getGroup() method to get the details of any group.

For more information on the same, you can refer to the documentation here.

9. List Group Members for a Group

Applozic: The Applozic SDK saves the group members for the groups in the local storage and fetches the data from the local databased when requested.

CometChat: The CometChat SDK allows you to fetch the list of group members for a particular group using the GroupMembersRequest class. Using this class, you can fetch the list of members in a paginated manner.

For more information on this, please refer to the documentation here.

CometChat provides all the above operations except for the context based chat that can however be achieved using the group tagging feature.

Types of Groups in CometChat

Scopes of Group Members in CometChat

Scopes of Group Member in CometChat

Messaging

Sending Messages

1. Text Messages

Both CometChat and Applozic allow sending of text messages and with additional information that can be added to the metadata field available in the Message object.

Applozic: Using the Applozic SDK, you can send a messages to any registered user/group.

To send messages to a registered user, follow the code snippet given below.

new MessageBuilder(context).setMessage("Hello there").setTo(userId).send();

To send messages to a registered group, follow the code snippet given below.

new MessageBuilder(context).setMessage("Hello there").setGroupId(123456).send();

CometChat:  Using the sendMessage() method provided by the CometChat SDK, you can send message to any user/group.

To send messages to a registered user:

To send messages to a registered group:

For more information on this, please refer to the documentation here.

2. Media Messages

Applozic: Attachment types supported by Applozic are:

  • Audio

  • Video

  • PDF

  • Image

  • GIF

  • DOC

  • Location

  • Contact

You can use the below code snippet to send a media message using the Applozic SDK.

CometChat: Attachment types supported by CometChat are:

  • Image

  • Audio

  • Video

  • File

You can use the below code snippet to send a media message using the CometChat SDK.

Both Applozic and CometChat allow sending additional metadata with media messages.

3. Custom Messages

CometChat allows sending of custom data as messages using the CustomMessage class. This option is not available in Applozic

4. Transient Messages

CometChat allows sending transient messages which are volatile messages that are not saved anywhere and cannot be fetched later. Applozic does not have this option.

CometChat also allows tagging of messages and fetching messages belonging to the specific tags.

For more information on how to send messages using CometChat, please check the docs here.

Receiving Messages in Real-Time

Applozic: Applozic uses the pub-sub model and the logged in user can generate a token using the refreshToken() method and then connect to the server using this token. The user is successfully connected to the server if the token provided is valid, else the token needs to be refreshed and then you can try again to establish the connection

Once the connection is established, the user will start receiving real-time events through various callback methods of the ApplozicUIListener class.

CometChat: When it comes to CometChat, CometChat provide 2 ways if managing the websocket connection

  1. Auto-establish the connection on init - As soon as the init method is called, if the user is logged in, the web-socket connection is established automatically by the SDK

  2. Manually manage the connection - The user can specify if he/she manually wants to manage the web-socket connection while calling the init method. If this method is chosen, the developer has complete control over the web-socket connection and can manage this using the connect() and disconnect() methods provided by the SDK.

For more information on this, you can refer to the documentation here.

Once the connection to the web-socket server is established, the SDK will start receiving all the real-time events via the 4 listener classes provided by the SDK viz.

1. UserListener

2. GroupListener

3. MessageListener

4. CallListener

For more detailed information on the real-time events provided by the CometChat SDK, you can refer to the documentation here.

Fetch Message History for Conversations

Both Applozic and CometChat provide ways to fetch message history for any conversation(user or group)

For Applozic:

1. Fetching messages for a user conversation:

2. Fetching messages for a group conversation:

For CometChat:

1. Fetching messages for a user conversation:

2. Fetching messages for a group conversation:

CometChat allows you to fetch messages based on various filters. For more information, you can refer to the documentation here.

Typing Indicators

Both CometChat and Applozic allow developers to send typing indicators to users and groups.

For Applozic:

1. Sending typing indicator to a user:

2. Sending typing indicator to a group:

For CometChat:

1. Sending typing indicator to a user:

2. Sending typing indicator to a group:

To send a stop typing notification you need to use the stopTyping() method provided by the CometChat SDK

For more information on the typing indicators, you can refer to the documentation here.

Read Receipts

Both CometChat and Applozic provide ways to mark messages as read.

For Applozic:

For CometChat:

1. Marking the messages for a conversation as delivered:

For groups, the receiverUID needs to be replaced by GUID of the group and the receiverType needs to be changed to CometChatConstants.RECEIVER_TYPE_GROUP.

2. For marking the messages as read:

For groups, the receiverUID needs to be replaced by GUID of the group and the receiverType needs to be changed to CometChatConstants.RECEIVER_TYPE_GROUP.

For more information on the same, you can refer to our Delivery & Read Receipts documentation.

Wrapping Up

This brings us to the end of the guide for a smooth and seamless migration from Applozic to CometChat. We hope you found this migration guide helpful in getting you up and running with CometChat.

Are you still confused? Don't worry! Our sales and support teams are overly dedicated to assisting you in this process, and should you face any challenges, get in touch with the CometChat sales and support teams.

About the Author

Aditya Gokula is an Android SDK developer at CometChat.

Aditya Gokula

CometChat

Aditya works as the Android SDK developer at CometChat.

Try out CometChat in action

Experience CometChat's messaging with this interactive demo built with CometChat's UI kits and SDKs.