Membership object
Membership represents 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 status: String?
7 public var type: String?
8 public var eTag: String?
9 public var updated: String?
10 public var lastReadMessageTimetoken: Timetoken?
11
12 ...
13}
| Parameter | Description |
|---|---|
chatType: ChatImpl | Reference to the main Chat protocol. |
channelType: ChannelImpl | ChannelImpl object. |
userType: UserImpl | UserImpl object. |
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. |
statusType: String | Status of the membership. |
typeType: String | Type of the membership. |
eTagType: String | Caching value that changes whenever the MembershipImpl object changes. |
updatedType: String | Last time the MembershipImpl object 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.
delete()getUnreadMessagesCount()lastReadMessageTimetokensetLastReadMessage()setLastReadMessageTimetoken()update()
Event listeners
You can call the following event listener methods on the Membership object.
Click on each method for more details.
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