Read/Delivered status for group messages not updated

I can see that onMessagesRead() method in CometChat’s message listener allows you to listen to read status updates of any messages. But as far as group messages go, the messageReceipts are pushed for every user in the group that reads the message. This results in the code being multiple times and there is no way to know whether the message is read by all users in the group real-time.

I would like to listen to the receipts only when ALL the users in the group have read/received the message, or you may have to add the updated message object every time with the messageReceipt.

Let me know at the earliest.

Issue found in Scenario:
Being a User of the app and in a group where I send a message, what possible way is there to know when ALL the users of the group has read my messages real-time?

SDK version being used:
com.cometchat:pro-android-chat-sdk:2.0.4-beta1

Hello @Deepan
From what i understand, you only need events when the messages for a group have been read by all the members of the group.
Currently, there is no such provision in CometChat SDK. We have taken your feedback and informed the concerned team about it. You can follow the progress for the same here

In the meanwhile, if you are looking for a workaround you can achieve the same using the steps mentioned below:

  1. As soon as a group chat window is opened, you can fetch the last message and obtain the message receipts for the same using the getMessageReceipts() method provided by the SDK. For more information regarding this method, please visit https://prodocs.cometchat.com/docs/android-messaging-receipts#receipt-history-for-a-single-message.
    This method will provide you with the information of how many members have read the message in that group.

  2. Now that you have the number of members who have read the message and you also have the count of the total members of the group, you can add a real-time message listener and keep listening to the real-time events for the message being read of the same group.

  3. For every receipt received real-time for the message being read, you can add 1 to the count of the members who have read the message and then compare if the total number of members who have read the message are equal to the total members in the group, you can mark the message as read for all the members in the group.

You only need to perform the above steps if the readAt field for the last message is set to 0. If the readAt field is not 0, it means that the message has already been read by all the members of the group.

Hope this helps.

1 Like

Thanks for the reply, the workaround that you suggested should work for now. We would appreciate, if you can give us an update on the actual listeners implementation once done, we are looking forward to it. I will let you know if I face any other issues with the suggested workflow.

Great @Deepan
You can follow the post i shared with you for updates.
We will be happy to assist you with other queries of yours if you have any.

Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.