PUBLISH
Since 1.1.0Pub/Sub
Syntax
PUBLISH channel messageSends message to every client subscribed to channel, with SUBSCRIBE, or to a pattern that matches it, with PSUBSCRIBE. Messages are not stored: a client that is not subscribed when one is sent never gets it.
Reply
- The number of clients that got the message. A client subscribed both to the channel and to a matching pattern gets it, and is counted, twice.
Examples
client 1> SUBSCRIBE news
1) "subscribe"
2) "news"
3) (integer) 1
client 2> PUBLISH news hello
(integer) 1
client 1>
1) "message"
2) "news"
3) "hello"