# SPUBLISH

> Send a message to the subscribers of a shard channel.

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

```
SPUBLISH shardchannel message
```

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

`SPUBLISH` delivers `message` to every connection subscribed to the shard
channel with [SSUBSCRIBE](https://docs.hotkv.com/commands/ssubscribe/index.md). In a cluster the command is
routed like a key to the shard that serves the channel's slot, and the message
reaches subscribers on that shard's nodes only. Pattern subscriptions do not
receive shard channel messages.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Integer: the number of subscribers on this node that received the message | Integer |

## Examples

```
127.0.0.1:6379> SPUBLISH orders:{eu} "order 1001 placed"
(integer) 1
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[SSUBSCRIBE](https://docs.hotkv.com/commands/ssubscribe/index.md), [PUBLISH](https://docs.hotkv.com/commands/publish/index.md),
[PUBSUB SHARDNUMSUB](https://docs.hotkv.com/commands/pubsub-shardnumsub/index.md)

In a cluster: [Keys, slots and commands in a cluster](https://docs.hotkv.com/clustering/keys-and-commands/index.md#pubsub)