Membership object
Membership represents a single user-channel relationship in a chat.
Properties
The Membership interface has the following properties:
1interface Membership {
2 val chat: Chat
3 val channel: Channel
4 val user: User
5 val custom: Map<String, Any?>?
6 val updated: String?
7 val eTag: String?
8 val lastReadMessageTimetoken: Long?
9 ...
10}
| Parameter | Description |
|---|---|
chatType: Chat | Reference to the main Chat object. |
channelType: Channel | Channel object. |
userType: User | User object. |
customType: Map<String, Any?> | Any custom properties or metadata associated with the user-channel relationship in the form of a map of key-value pairs. App Context filtering language doesn’t support filtering by custom properties. |
updatedType: String | Last time the Membership object was changed. |
eTagType: String | Caching value that changes whenever the Membership object changes. |
lastReadMessageTimetokenType: Long | Timetoken of the last message a user read on a given channel. |
API limits
To learn about the maximum length of parameters used to set channel membership metadata, refer to REST API docs.
Methods
The Membership object exposes the following methods and properties.
getUnreadMessagesCount()lastReadMessageTimetokensetLastReadMessage()setLastReadMessageTimetoken()streamUpdates()streamUpdatesOn()update()
Use case
Membership methods enable:
- Updating user-channel relationships and getting updates on changes
- Tracking the last message read by a user on a channel
- Getting the count of unread messages for a user