Membership object
Membership is an object that refers to a single user-channel relationship in a chat.
Properties
The MembershipImpl class implements the Membership protocol and takes the following properties:
1extension MembershipImpl: Membership {
2    public var chat: ChatImpl
3    public var channel: ChannelImpl
4    public var user: UserImpl
5    public var custom: [String: JSONCodableScalar]?
6    public var eTag: String?
7    public var updated: String?
8    public var lastReadMessageTimetoken: Timetoken?
9
10     ...
11}
| Parameter | Description | 
|---|---|
| chatType:  ChatImpl | Reference to the main Chatprotocol. | 
| channelType:  ChannelImpl | ChannelImplobject. | 
| userType:  UserImpl | UserImplobject. | 
| customType:  [String: JSONCodableScalar] | Any custom properties or metadata associated with the user-channel relationship in the form of a dictionary of key-value pairs. App Context filtering language doesn’t support filtering by custom properties. | 
| eTagType:  String | Caching value that changes whenever the MembershipImplobject changes. | 
| updatedType:  String | Last time the MembershipImplobject was changed. | 
| lastReadMessageTimetokenType:  Timetoken | 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-related 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.