Mark as read sometimes not working as expected

Hi CometChat Team,

When I try to mark my messages as read, sometimes it is working no problem at all, but sometimes it isn’t, currently I don’t really know what’s triggering it, but I feel like I have already sent the correct messageId, receiverId and receiverType.
Here attached is my code and the log in my browser, I’ve sent the last messageId of the conversation (2006), the guid of the group, and the group type, but when I fetch the conversation, the unreadMessageCount is still there.

When I faced this problem, usually I try to re-log the user and run this markAsRead again, and it works no problem.
Can you help me with this problem? Thank you in advance.



Hello @jordyaj,

Mark as read only works when you are connected to our WS server. You can check for the current connection status by using the CometChat.getConnectionStatus(). Also, we do have a Connection Listener which gives you real-time updates on the connection status, you can read more about the Connection Listeners here.

Warm Regards,

CometChat Pro
Mayur Bhandari

1 Like

Thank you for your response Mayur, if so, I will read about the Connection Listeners first.