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 eTag: String?
7 public var updated: String?
8 public var lastReadMessageTimetoken: Timetoken?
9
10 ...
11}
| 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. |
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.
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