get Unread Messages Count
Get number of unread messages in the conversation.
Note: if the last read index has not been yet set for current user as the participant of this conversation then unread messages count is considered uninitialized. In this case null is returned. See setLastReadMessageIndex.
This method is semi-realtime. This means that this data will be eventually correct, but will also possibly be incorrect for a few seconds. The Conversations system does not provide real time events for counter values changes.
So this is quite useful for any “unread messages count” badges, but is not recommended to build any core application logic based on these counters being accurate in real time.
This function performs an async call to service to obtain up-to-date message count. The retrieved value is then cached for 5 seconds so there is no reason to call this function more often than once in 5 seconds.
Use this method to obtain number of unread messages together with setLastReadMessageIndex instead of relying on Message indices which may have gaps. See getMessageIndex for details.
See also
#getMessagesCount
Parameters
Listener to receive results of the query.