Membership object
Membership
is an object that refers to a single user-channel relation in a chat.
Properties
The Membership
object has the following properties:
class Membership {
channel: Channel,
user: User,
custom: ObjectCustom
}
Parameter | Type | Description |
---|---|---|
channel | Channel | Channel object. |
user | User | User object. |
custom | ObjectCustom | Any custom properties or metadata associated with the channel-user membership, such as lastReadMessageTimetoken . |
Methods
You can call the following methods on the Membership
object.
Click on each method for more details.
getUnreadMessagesCount()
- (getter)
lastReadMessageTimetoken
setLastReadMessage()
setLastReadMessageTimetoken()
streamUpdates()
- (static)
streamUpdatesOn()
update()
Use case
For example, you can use the Membership
object methods to:
- Update information on the user-channel relation 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.