ChannelGroup object
ChannelGroup represents a collection of channels that can be subscribed to as a single unit. Subscribe to multiple channels with one call instead of managing individual subscriptions.
Publishing to a channel group is not supported - publish to each channel individually.
Requires Stream Controller add-on
Enable the Stream Controller add-on for your key in the Admin Portal. Refer to the support page for details.
Properties
The ChannelGroupImpl class implements the ChannelGroup protocol and has the following properties:
1public final class ChannelGroupImpl: ChannelGroup {
2 public let chat: ChatImpl
3 public let id: String
4}
| Parameter | Description |
|---|---|
idType: String | Unique identifier for the channel group. |
chatType: ChatImpl | Reference to the main Chat object. |
Methods
You can call the following methods on the ChannelGroup object.
Click on each method for more details.
addChannelIdentifiers(_:)add(channels:)connect()listChannels()removeChannelIdentifiers(_:)remove(channels:)streamPresence()whoIsPresent()
Use case
ChannelGroup methods enable:
- Subscribing to messages from multiple channels at once
- Monitoring presence across all channels in the group
- Dynamically adding or removing channels as users join or leave conversations
- Simplified message handling for multi-chat apps