Skip to main content

Retrieving community subchannels

Use the client SDK to retrieve subchannels within a community channel.

Get joined subchannels

Call getSubChannels() on a CommunityChannel instance to retrieve the list of subchannels the current user has joined.

tip

This API only returns subchannels the current user belongs to. For a complete list of all subchannels (including those the user has not joined), maintain the list on your app server and serve it to the client.

kotlin
val communityChannel = CommunityChannel("communityId")

communityChannel.getSubChannels { subChannels, error ->
if (error == null && subChannels != null) {
for (subChannel in subChannels) {
println("Subchannel ID: ${subChannel.subChannelId}")
println("Subchannel Type: ${subChannel.channelType}")
}
} else {
// Failed: ${error?.message}
}
}

CommunitySubChannel properties

PropertyTypeDescription
subChannelIdStringSubchannel ID
channelTypeIntSubchannel type identifier

Creating and deleting subchannels

Creating and deleting subchannels must be done via the Server API.

OperationServer API
Create a subchannelCreate Subchannel
Delete a subchannelDelete Subchannel

After creating or deleting a subchannel on your server, notify clients to refresh their subchannel lists.