On this page

ChannelGroup entity

ChannelGroup is an object that refers to a collection of channels you can manage and subscribe to as a single unit. Channel groups let you subscribe to multiple channels with a single call, making it easier to handle scenarios like receiving messages from all channels a user is a member of.

You can't publish to a channel group. You can only subscribe to it. To publish within a channel group, you need to publish to each channel individually.

Requires Stream Controller add-on

This method requires that the Stream Controller add-on is enabled for your key in the Admin Portal. Read the support page on enabling add-on features on your keys.

Properties

The ChannelGroup interface has the following properties:

1interface ChannelGroup {
2 val id: String
3 val chat: Chat
4
5 ...
6}
ParameterDescription
id
Type: String
Unique identifier for the channel group.
chat
Type: Chat
Reference to the main Chat object.

Methods

You can call the following methods on the ChannelGroup object.

Click on each method for more details.

Use case

You can use the ChannelGroup methods to:

  • Subscribe to messages from multiple channels at once without managing individual channel subscriptions.
  • Monitor presence across all channels in the group to see which users are online.
  • Dynamically add or remove channels from the group as users join or leave conversations.
  • Simplify message handling in apps where users participate in many simultaneous chats.
Last updated on