On this page

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 the Channel object)

    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 the Chat object)

    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

ParameterRequired in update()Required in updateChannel()Description
id
Type: String
Default:
n/a
No
Yes
Unique channel identifier.
name
Type: String
Default:
n/a
No
No
Display name for the channel.
custom
Type: [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.
description
Type: String
Default:
n/a
No
No
Additional details about the channel.
status
Type: String
Default:
n/a
No
No
Tag that categorizes a channel by its state, like archived.
type
Type: ChannelType
Default:
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

ParameterDescription
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 channel
  • streamUpdatesOn() - 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 updated Channel object on each change (nil if 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

ParameterRequired in streamUpdates()Required in streamUpdatesOn()Description
channels
Type: [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 support channel.

    1
    
  • streamUpdatesOn()

    Get updates on the support and incident-management channels.

    1
    
Last updated on