publish.3valkey - Man Page

Posts a message to a channel.

Synopsis

PUBLISH channel message

Description

Posts a message to the given channel.

In a Valkey Cluster clients can publish to every node. The cluster makes sure that published messages are forwarded as needed, so clients can subscribe to any channel by connecting to any one of the nodes.

Reply

valkey-protocol(7) Integer reply: the number of clients that received the message. Note that in a Valkey Cluster, only clients that are connected to the same node as the publishing client are included in the count.

Complexity

O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client).

Acl Categories

@fast @pubsub

History

See Also

psubscribe(3valkey), pubsub(3valkey), pubsub-channels(3valkey), pubsub-help(3valkey), pubsub-numpat(3valkey), pubsub-numsub(3valkey), pubsub-shardchannels(3valkey), pubsub-shardnumsub(3valkey), punsubscribe(3valkey), spublish(3valkey), ssubscribe(3valkey), subscribe(3valkey), sunsubscribe(3valkey), unsubscribe(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual