Manage channel updates
Update channel metadata and receive real-time change events.
Requires App Context
Enable App Context for your keyset in the Admin Portal.
Update channel details
Edit channel metadata with update() or updateChannel().
Both methods produce the same result. Call update() on a Channel object or updateChannel() on the Chat object with the channel ID.
Method signature
These methods take the following parameters:
-
update()(on theChannelobject)1channel.update(
2 name: String? = nil,
3 custom: [String: JSONCodableScalar]? = nil,
4 description: String? = nil,
5 status: String? = nil,
6 type: ChannelType? = nil
7) async throws -> ChannelImpl -
updateChannel()(on theChatobject)1chat.updateChannel(
2 name: String? = nil,
3 custom: [String: JSONCodableScalar]? = nil,
4 description: String? = nil,
5 status: String? = nil,
6 type: ChannelType? = nil
7) async throws -> ChannelImpl
Input
| Parameter | Required in update() | Required in updateChannel() | Description |
|---|---|---|---|
idType: StringDefault: n/a | No | Yes | Unique channel identifier. |
nameType: StringDefault: n/a | No | No | Display name for the channel. |
customType: [String: JSONCodableScalar]Default: n/a | No | No | JSON providing custom data about the channel. Values must be scalar only; arrays or objects are not supported. App Context filtering language doesn’t support filtering by custom properties. |
descriptionType: StringDefault: n/a | No | No | Additional details about the channel. |
statusType: StringDefault: n/a | No | No | Tag that categorizes a channel by its state, like archived. |
typeType: ChannelTypeDefault: n/a | No | No | Tag that categorizes a channel by its function, like offtopic. |
API limits
To learn about the maximum length of parameters used to set channel metadata, refer to REST API docs.
Output
| Parameter | Description |
|---|---|
ChannelImpl | Object containing the updated channel with its metadata. |
Sample code
Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
Update the description of the support channel.
update()
1
Get channel updates
Receive updates when Channel objects are edited or removed:
streamUpdates()- monitors a single channelstreamUpdatesOn()- monitors multiple channels
Both methods return an asynchronous stream that produces a new value whenever channel metadata changes. They subscribe to a channel and add an objects event listener for channel events.
Stream update behavior
streamUpdates()returns the updatedChannelobject on each change (nilif deleted)streamUpdatesOn()returns the complete list of monitored channels on any change
Method signature
These methods take the following parameters:
-
streamUpdates()1channel.streamUpdates() -> AsyncStream<ChannelImpl?> -
streamUpdatesOn()(static)1ChannelImpl.streamUpdatesOn(
2 channels: [ChannelImpl]
3) -> AsyncStream<[ChannelImpl]>
Input
| Parameter | Required in streamUpdates() | Required in streamUpdatesOn() | Description |
|---|---|---|---|
channelsType: [ChannelImpl]Default: n/a | No | Yes | A collection of ChannelImpl objects for which you want to get updates. |
Output
An asynchronous stream that produces updates when the underlying channel(s) change.
Sample code
Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
-
streamUpdates()Get updates on the
supportchannel.- AsyncStream
- Closure
11 -
streamUpdatesOn()Get updates on the
supportandincident-managementchannels.- AsyncStream
- Closure
11