> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish To Channel • AI Agent SDK

> publish_to_channel: Publish an event to all subscribers of a channel.

# publish\_to\_channel

<div className="flex items-center gap-2">
  <Badge color="blue">Async</Badge>
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**PushChannelProtocol**](../classes/PushChannelProtocol) class in the [**protocols**](../modules/protocols) module.

Publish an event to all subscribers of a channel.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def publish_to_channel(channel_name: str, event: GatewayEvent, exclude: Optional[List[str]]) -> int
```

## Parameters

<ParamField query="channel_name" type="str" required={true}>
  Target channel
</ParamField>

<ParamField query="event" type="GatewayEvent" required={true}>
  The event to deliver
</ParamField>

<ParamField query="exclude" type="Optional" required={false}>
  Optional client IDs to skip
</ParamField>

### Returns

<ResponseField name="Returns" type="int">
  Number of clients the event was sent to
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L1337">
  `praisonaiagents/gateway/protocols.py` at line 1337
</Card>
