Confused about "Unread"?
Let us know how we can improve our documentation:
The most common use case for client-level events is unread counts. Here's an example of a complete unread count integration for your chat app. As a first step we get the unread count when the user connects:
By default the UI component SDKs (React, React Native, ...) mark messages as read automatically when the channel is visible. You can also make the call manually like this:
While you're using the app, the unread count can change. A user can be added to a channel, a new message can be created, or the user can mark the messages as seen on another tab/device.
markRead function can also be executed server-side by passing a user ID as shown in the example below:
To support updating the unread count in real-time, you can listen to these events:
These two events include the fields
unread_channels. You can listen to them all at once like this: