I'm trying to get the number of messages unread for a specific member in a specific channel. To do 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);
});
The unread count always return 0. To test, I do the following:
- user 2 submitting a message to myChannel in another chrome tab
- user 2 myChannel get's updated with the message from (1) via .on('messageAdded', [...])
- refresh user 1 chrome tab, and get getUnconsumedMessagesCount with value of 0
- If I call myChannel.getMessages() for user1, I see the message from user2
Initially I called .getUnconsumedMessagesCount() without doing join() first, I thought this could be the issue, but even with join still nothing.