How to close the existing channel session once we close the chat window?

We have a use case like User-A can see the list of channels where he is part of the group channel.

User-A has opened the group channel chat and had some conversation with User-B and then he closes the chat window. After some time User-B has sent some couple of new messages. Since User-A has close the chat window for him the new messages should be shown as unread message, But all the new message are getting consider as read & User-A is missing the those messages.

So to fix the above issue please let us know how to close the group channel season properly. We are using “sendbirdmin.js” & “chat.js” like websample app.

Hi @Development_Account,

Can you share with us how you’re “closing” the chat window? If you’re not using the UIKit you would have to be manually calling the markAsRead() method, otherwise the messages would be considered unread.

Hi @Tyler already we are calling markAsRead() on isCurrentChannel and if channel.groupchannnel().

Is there any channel.close() behaviour is there to close current channel ?

Hi @Development_Account,

Can you show me how you’re calling markAsRead()? There is no such channel.close() behavior as its intended you implement any unsubscribe logic yourself.

@Tyler Please find the code snippet

if (isCurrentChannel && channel.isGroupChannel()) {
    } else {
      if (channel.isGroupChannel()) {

Is there any chance that you’re somehow falling into the first if condition even though you’re not intending to?

One thing that would also be helpful is if you could DM me the following information so I can track down on our side if we’re seeing anything wonky:

  • Application ID
  • Timestamp where you received a message but did not see the unreadCountUpdate
  • Message ID of that received message
  • User ID you’re logged into, that received the message

Ideally, the first two are the most important as I won’t be able to narrow down logging without them.

@Tyler Thanks for the update.