Membership object
Membership
is an object that refers to a single user-channel relationship in a chat.
Properties
The Membership
interface has the following properties:
interface Membership {
val chat: Chat
val channel: Channel
val user: User
val custom: Map<String, Any?>?
val updated: String?
val eTag: String?
val lastReadMessageTimetoken: Long?
...
}
Parameter | Type | Description |
---|---|---|
chat | Chat | Reference to the main Chat object. |
channel | Channel | Channel object. |
user | User | User object. |
custom | 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. |
updated | String | Last time the Membership object was changed. |
eTag | String | Caching value that changes whenever the Membership object changes. |
lastReadMessageTimetoken | 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
You can call the following methods and properties on the Membership
object.
Click on each method or property for more details.
getUnreadMessagesCount()
lastReadMessageTimetoken
setLastReadMessage()
setLastReadMessageTimetoken()
streamUpdates()
streamUpdatesOn()
update()
Use case
For example, you can use the Membership
object methods to:
- Update information on the user-channel relationship and get updates on such changes.
- Decide what is the last message read by a user on a given channel.
- Get information on the total amount of messages unread by a user on a channel.