PUBLISH

Syntax

1. PUBLISH channel message

Time 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: @pubsub, @fast

Posts a message to the given channel.

Return

Integer reply: the number of clients that received the message.

Examples

1. user:1> PSUBSCRIBE "h[ae]llo"
2. user:2> PSUBSCRIBE "h*llo"
3. ---
4. dragonfly> PUBLISH "hello" message1
5. (integer) 2
6. dragonfly> PUBLISH "hllo" message2
7. (integer) 1 # user 2
8. dragonfly> PUBLISH "heello" message3
9. (integer) 1 # user 2
10. dragonfly> PUBLISH "hello world" message4
11. (integer) 0