---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/channels/updates
title: Manage channel updates
updated_at: 2026-06-12T11:23:13.112Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Manage channel updates

Update channel metadata and receive real-time change events.

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) for your keyset in the [Admin Portal](https://admin.pubnub.com/).
:::

## 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? = nil7) 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? = nil7) async throws -> ChannelImpl

#### Input

| Parameter | Required in update() | Required in updateChannel() | Description |
| --- | --- | --- | --- |
| id | String | Optional |  | No | Yes | Unique channel identifier. |
| name | String | Optional |  | No | No | Display name for the channel. |
| custom | [String: | Optional |  | No | No | JSON providing custom data about the channel. Values must be scalar only; arrays or objects are not supported. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |
| description | String | Optional |  | No | No | Additional details about the channel. |
| status | String | Optional |  | No | No | Tag that categorizes a channel by its state, like `archived`. |
| type | ChannelType | Optional |  | No | No | Tag that categorizes a channel by its function, like `offtopic`. |

:::tip API limits
To learn about the maximum length of parameters used to set channel metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata).
:::

#### Output

| Parameter | Description |
| --- | --- |
| `ChannelImpl` | Object containing the updated channel with its metadata. |

### Sample code

:::tip 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()`

```swift
// Assumes a "ChatImpl" reference named "chat"
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    let updatedChannel = try await channel.update(name: "This is the updated description for the support channel")
    debugPrint("Updated channel: \(updatedChannel)")
  } else {
    debugPrint("Channel not found")
  }
}
```

## Get channel updates

Receive real-time updates when a [Channel object](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/channel) is edited with `onUpdated()`, or be notified when it is deleted with `onDeleted()`.

You can also use `channel.stream.updates()` and `channel.stream.deletions()` for `AsyncStream`-based equivalents.

For monitoring multiple channels at once, `streamUpdatesOn()` remains available.

:::note Deprecation
`streamUpdates()` is deprecated. Use `onUpdated()` and `onDeleted()` (closure-based) or `channel.stream.updates()` and `channel.stream.deletions()` (AsyncStream-based) instead.
:::

### Method signature

* onUpdated() — closure called when the channel metadata changes 1channel.onUpdated(2 callback: @escaping (ChannelImpl) -> Void3) -> AutoCloseable
* onDeleted() — closure called when the channel is deleted 1channel.onDeleted(2 callback: @escaping () -> Void3) -> AutoCloseable
* streamUpdatesOn() (static) — monitors multiple channels 1ChannelImpl.streamUpdatesOn(2 channels: [ChannelImpl]3) -> AsyncStream<[ChannelImpl]>

#### Input

| Parameter | Description |
| --- | --- |
| `callback` (in `onUpdated`) *Type: `(ChannelImpl) -> Void`Default: n/a | Closure called with the updated channel whenever its metadata changes. |
| `callback` (in `onDeleted`) *Type: `() -> Void`Default: n/a | Closure called when the channel is deleted. |
| `channels` (in `streamUpdatesOn`) *Type: `[ChannelImpl]`Default: n/a | A collection of [ChannelImpl objects](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/channel) for which you want to get updates. |

#### Output

| Parameter | Description |
| --- | --- |
| `AutoCloseable` | An object you must retain. When released or closed, the listener stops. |

### Sample code

:::tip 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.
:::

Get updates on the `support` channel.

###### Closure

```swift
// Assumes a "ChannelImpl" reference named "channel"
  
// Important: Keep a strong reference to the returned "AutoCloseable" object as long as you want
// to receive updates. If the "AutoCloseable" is deallocated, the stream will be cancelled,
// and no further items will be produced. You can also stop receiving updates manually
// by calling the "close()" method on the "AutoCloseable" object.
autoCloseable = channel.streamUpdates { updatedChannel in
  // The closure receives the entire updated Channel object each time a change occurs.
  if let updatedChannel = updatedChannel {
    debugPrint("Received update for channel with ID: \(updatedChannel.id)")
  } else {
    debugPrint("Channel was deleted")
  }
}
```

###### AsyncStream

```swift
// Assumes a "ChatImpl" reference named "chat"
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    for await updatedChannel in channel.streamUpdates() {
      // The stream returns the entire updated Channel object each time a change occurs.
      if let updatedChannel = updatedChannel {
        debugPrint("Updated channel: \(updatedChannel)")
      } else {
        debugPrint("Channel was deleted")
      }
    }
  } else {
    debugPrint("Channel not found")
  }
}
```

#### Watch multiple channels

Get updates on multiple channel objects at once.

##### Closure

```swift
// Assumes an array of "ChannelImpl" objects named "channels"
  
// Important: Keep a strong reference to the returned "AutoCloseable" object as long as you want
// to receive updates. If the "AutoCloseable" is deallocated, the stream will be cancelled,
// and no further items will be produced. You can also stop receiving updates manually
// by calling the "close()" method on the "AutoCloseable" object.
autoCloseable = ChannelImpl.streamUpdatesOn(channels: channels) { updatedChannels in
  // The closure receives the complete list of all channels you're monitoring
  // each time any change occurs.
  for updatedChannel in updatedChannels {
    debugPrint("Received update for channel with ID: \(updatedChannel.id)")
  }
}
```

##### AsyncStream

```swift
// Assumes a "ChatImpl" reference named "chat"
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    for await updatedChannels in ChannelImpl.streamUpdatesOn(channels: [channel]) {
      // The stream returns the complete list of all channels you're monitoring
      // each time any change occurs.
      debugPrint("Updated channels: \(String(describing: updatedChannels))")
    }
  } else {
    debugPrint("Channel not found")
  }
}
```

## Terms in this document

* **Access Manager** - A cryptographic, token-based permission administrator that allows you to regulate clients' access to PubNub resources, such as channels, channel groups, and user IDs.
* **Action** - The type of activity (procedure) to execute when a condition is satisfied (for example, sending a message).
* **Billing alert notification** - A means of informing a user that a billing alert has been triggered. Before notifications can happen, a billing alert must be triggered first.
* **Business Object** - A container for data fields and metrics that defines aggregations and data sources.
* **Channel** - A pathway for sending and receiving messages between devices, created automatically when you first use it, that can handle any number of users and messages for different communication needs, like 1-1 text chats, group conversations, and other data streaming.
* **Channel pattern** - A way to group and analyze channel data to track performance metrics like message counts and user engagement over time with PubNub Insights.
* **Condition** - A requirement that must be satisfied or evaluated to true for an action to be executed. Input in a decision table.
* **Cryptor** - An implementation of a specific cryptographic algorithm used for data encryption/decryption that adheres to a standard interface.
* **Dashboard** - A collection of widgets (charts) that give an overview of the metrics one is evaluating.
* **Data fields** - Data you want Illuminate to track. These can be quantitative (measures), like "Number" or "Timestamp" or qualitative (dimensions) values, like "String" that can be used to categorize and segment data. Data fields can be aggregated and calculated.
* **Decision** - A collection (or decision table) of conditions and actions. When conditions are satisfied, the corresponding actions are triggered as per defined rules.
* **End Customer** - A customer of a PubNub partner. End customers do not have direct access to the Admin Portal. Instead, they interact with PubNub products—such as Illuminate—through the partner’s portal, where PubNub services are embedded. They can create PubNub objects only within this partner-provided environment.
* **Entity** - A subscribable object within a PubNub SDK that allows you to perform context-specific operations.
* **Listener** - A function or objectthat reacts to events or messages, like new chat messages or connection updates, letting your app respond in real-time.
* **Mapped/Unmapped** - Whether the data source for a data field has been defined or the action has been configured.
* **MCP Server** - A Model Context Protocol server that coordinates communication and synchronization between AI agents, clients, or services, such as Cursor IDE and Windsurf.
* **Message** - A unit of data transmitted between clients or between a client and a server in PubNub, containing information such as text, binary data, or structured data formats like JSON. Messages are sent over channels and can be tracked for delivery and read status.
* **Metric** - What exactly is evaluated using measures and dimensions (collectively called data fields), as well as aggregation functions.
* **Module** - A Functions v1 container that groups related functions for configuration and deployment on an app’s keysets.
* **Origin** - The subdomain used to establish a connection to the PubNub network that allows your application's traffic to appear like it's coming from your own domain.
* **Package** - A Functions v2 container that groups Functions, tracks Revisions, and is deployed to keysets.
* **Partner** - A PubNub customer who resells PubNub products, such as Illuminate, to their own customers. Partners have access to the Admin Portal, enabling them to create and manage PubNub objects for themselves or on behalf of their end customers.
* **Publish Key** - A unique identifier that allows your application to send messages to PubNub channels. It's part of your app's credentials and should be kept secure.
* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
* **Push token** - A device identifier issued by a push provider (APNs or FCM) used to register a device for receiving mobile push notifications.
* **Rule** - A definition (row in a decision table) stating which action should be triggered for which condition.
* **Service Integration** - A machine identity that represents a program or service consuming the Admin API, scoped to your account and authenticated using expirable API keys with configurable permissions.
* **Signal** - A non-persistent message limited to 64 bytes designed for high-volume usecases where the the most recent data is relevant, like GPS location updates.
* **Subscribe Key** - A unique identifier that allows your application to receive messages from PubNub channels. It's part of your app's credentials and should be kept secure.
* **Timetoken** - A unique identifier for each message that represents the number of 100-nanosecond intervals since January 1, 1970, for example, 16200000000000000.
* **Trigger details** - A set of predefined criteria for a given billing alert. When met, billing alert notifications are generated.
* **User** - An individual or entity that interacts with a system, application, or service. In PubNub, a user typically refers to someone who sends or receives messages through the platform, identified by a unique user ID or username.
* **User ID** - UTF-8 encoded, unique string of up to 92 characters used to identify a single client (end user, device, or server) that connects to PubNub.
* **Vibe Coding** - A way to build applications in an intuitive, relaxed, and improvisational manner, using AI tools and natural language descriptions.
