# SUNSUBSCRIBE

> Unsubscribe the connection from shard channels.

URL: https://docs.hotkv.com/commands/sunsubscribe/

```
SUNSUBSCRIBE [shardchannel [shardchannel ...]]
```

- Group: Pub/Sub
- Complexity: O(N) for N shard channels
- HotKV Cloud: all plans
- On-Premise: no license needed

`SUNSUBSCRIBE` removes the given shard channel subscriptions. Without
arguments it removes every shard channel subscription of the connection, and
leaves channel and pattern subscriptions alone.

## Return value

One confirmation per shard channel removed (or per shard channel named):

| Element | Value |
| --- | --- |
| 1 | Bulk string `sunsubscribe` |
| 2 | Bulk string: the shard channel |
| 3 | Integer: the number of shard channels still subscribed |

When called without arguments and the connection has no shard channel
subscriptions, a single confirmation is sent with a nil channel and a count of
`0`. On RESP3 the confirmations are push messages.

## Examples

```
127.0.0.1:6379> SSUBSCRIBE orders:{eu}
1) "ssubscribe"
2) "orders:{eu}"
3) (integer) 1
127.0.0.1:6379> SUNSUBSCRIBE orders:{eu}
1) "sunsubscribe"
2) "orders:{eu}"
3) (integer) 0
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[SSUBSCRIBE](https://docs.hotkv.com/commands/ssubscribe/index.md), [UNSUBSCRIBE](https://docs.hotkv.com/commands/unsubscribe/index.md)