---
title: "Channel"
description: "This page lists the TypeScript SDK names for Channels."
canonical_url: "https://docs.superdurable.io/zh-Hans/reference/typescript/channel/"
source: "docs/reference/typescript/channel.mdx"
locale: "zh-Hans"
---

# Channel

This page lists the TypeScript SDK names for [Channels](https://docs.superdurable.io/zh-Hans/concepts/primitives/channel.md).
The doc comment of each API gives its parameters, defaults, and errors. Read
them in the [TypeScript SDK API reference](https://docs.superdurable.io/zh-Hans/reference/typescript.md#api-reference).

<a id="api-names"></a>

## API names

| Task                                           | TypeScript API                                                                         | Dex behavior                                                                                                                             |
| ---------------------------------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Define a Channel                               | **Channel**                                                                            | [Channels](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channels)                                               |
| Define a ChannelMap                            | **ChannelMap**                                                                         | [ChannelMap](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channelmap)                                           |
| Declare it in the Flow                         | **channels** of the **PersistenceSchema** returned from **getPersistenceSchema**       | [Flow definition](https://docs.superdurable.io/zh-Hans/reference/typescript/flow.md#flow-definition)                                     |
| Publish a message from a Step or RPC           | **publish**                                                                            | [Commits](https://docs.superdurable.io/zh-Hans/reference/typescript/step.md#commit-boundary)                                             |
| Wait for messages                              | **forOne**, **forN**, **atLeast**, **atMost**, and **range**                           | [Wait conditions](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channel-conditions)                              |
| Read the messages a wait consumed              | **results**                                                                            | [Channel results](https://docs.superdurable.io/zh-Hans/reference/typescript/waits.md#channel-results)                                    |
| Load pending messages for a method             | **ChannelMap.loadMessages**, with the load fields of **StepOptions** or **RPCOptions** | [Selective state loading](https://docs.superdurable.io/zh-Hans/reference/typescript/step-options.md#selective-state-loading)             |
| Read loaded pending messages                   | **pendingMessages** and **findPendingMessage**                                         | [Pending messages](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#manage-pending-messages)                        |
| Delete a pending message                       | **delete**                                                                             | [Pending messages](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#manage-pending-messages)                        |
| Read the number of pending messages            | **size**                                                                               | [Selective state loading](https://docs.superdurable.io/zh-Hans/reference/typescript/step-options.md#selective-state-loading)             |
| Count ChannelMap instances and list their keys | **ChannelMap.getMapSize** and **ChannelMap.getAllInstanceKeys**                        | [ChannelMap](https://docs.superdurable.io/zh-Hans/reference/server/runtime-data.md#channelmap)                                           |
| Complete the Flow only when Channels are empty | **forceCompleteIfChannelsEmpty**                                                       | [ForceCompleteIfChannelsEmpty](https://docs.superdurable.io/zh-Hans/reference/typescript/step-decisions.md#forcecompleteifchannelsempty) |

<a id="example"></a>

## Example

Example: [examples/typescript/src/primitives/channel/channel-flow.ts](https://github.com/superdurable/dex/tree/main/examples/typescript/src/primitives/channel/channel-flow.ts)
