# PUBSUB CHANNELS

> List the channels that currently have subscribers.

URL: https://docs.hotkv.com/commands/pubsub-channels/

```
PUBSUB CHANNELS [pattern]
```

- Group: Pub/Sub
- Complexity: O(N) where N is the number of active channels
- HotKV Cloud: all plans
- On-Premise: no license needed

`PUBSUB CHANNELS` returns the channels on this node that have at least one
[SUBSCRIBE](https://docs.hotkv.com/commands/subscribe/index.md) subscriber. Pattern subscriptions are not
counted, and shard channels are listed by
[PUBSUB SHARDCHANNELS](https://docs.hotkv.com/commands/pubsub-shardchannels/index.md) instead. With
`pattern`, only channels matching that glob pattern are returned.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Array of bulk strings (empty when there are none) | Array |

More than one pattern is an error:
`ERR unknown subcommand or wrong number of arguments for 'CHANNELS'. Try PUBSUB HELP.`

## Examples

```
127.0.0.1:6379> PUBSUB CHANNELS
1) "news"
2) "alerts"
127.0.0.1:6379> PUBSUB CHANNELS al*
1) "alerts"
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[PUBSUB NUMSUB](https://docs.hotkv.com/commands/pubsub-numsub/index.md), [PUBSUB](https://docs.hotkv.com/commands/pubsub/index.md),
[SUBSCRIBE](https://docs.hotkv.com/commands/subscribe/index.md)