Channel overview
A channel is a logical relationship that the SDK automatically creates and maintains based on message information such as sender, receiver, and channel type.
Channel types
The Chat SDK uses the ChannelType enum to represent channel types:
| Enum | Description |
|---|---|
direct | Direct channel |
group | Group channel |
open | Open channel |
community | Community channel |
system | System channel |
Direct channel
A one-to-one channel between two users. The users may or may not be friends — the SDK does not manage user relationships. The SDK creates and maintains the channel relationship.
Messages in direct channels are stored in the local database.
Group channel
A channel with two or more users. Group membership is managed by your app. The SDK only delivers messages to all group members.
Messages in group channels are stored in the local database.
Community channel
Community channels provide a group structure with independent subchannels. Message data (channels, messages, unread counts) and members are organized by subchannel, and messages are independent across subchannels.
Messages in community channels are stored in the local database. See Community channel overview for details.
Open channel
Open channels have no member limit. Messages arrive in real time at massive scale. Users stop receiving messages after leaving an open channel. Push notifications are not supported. The SDK creates and maintains the connection. Users join or leave through SDK APIs.
The SDK does not persist open channel messages. All data for an open channel is cleared when the user leaves. See Open channel overview for details.
System channel
System channels are created when a system account sends messages to users, such as broadcasts or friend request notifications.
Channel entity class
The client SDK's channel entity class is BaseChannel. All channel-related information is accessible through this class.
| Property | Type | Description |
|---|---|---|
channelType | ChannelType | Channel type |
channelId | String | Channel ID. For direct channels: the other user's ID. For group channels: group ID. For open channels: open channel ID. For system channels: system account ID. |
unreadCount | int? | Unread message count |
mentionedCount | int? | Unread @ message count in this channel |
mentionedMeCount | int? | Unread messages that @-mention the current user |
isPinned | bool? | Whether the channel is pinned |
draft | String? | Saved draft content |
latestMessage | Message? | Last message stored locally |
notificationLevel | NoDisturbLevel? | Do not disturb level |
firstUnreadMsgSendTime | int? | Timestamp of the first unread message (community channels only) |
operationTime | int? | Channel operation timestamp |
translateStrategy | TranslateStrategy? | Message translation strategy |