I am trying to get the number of unread messages for a specific member in a specific channel. For this, I was hoping to use channel.getUnconsumedMessagesCount () , as defined in the documentation .
myChannel.join() .then(function(c) { console.log('Joined channel ' + c.sid); return myChannel.getUnconsumedMessagesCount(); }) .then(m => { console.log('current count unread: ' + m); });
An unread counter always returns 0. To check, I do the following:
- user 2 sends a message to myChannel in another Chrome tab
- user 2 myChannel is updated with a message from (1) via .on ('messageAdded', [...])
- update user 1 chrome tab and get getUnconsumedMessagesCount with value 0
- If I call myChannel.getMessages () for user1, I see a message from user2
At first, I called .getUnconsumedMessagesCount (), without first doing join (), I thought it might be a problem, but even with joining, it's still nothing.
source share