PUBLISH

Sends a message to matching channel and pattern subscriptions.

Pub/Sub · Example verified

Syntax covered here

PUBLISH channel message

Delivery was verified on a separate subscriber connection for both subscription forms; the result counts matching live subscriptions.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: subscriber
> SUBSCRIBE updates
["subscribe","updates",1]
# connection: default
> PUBSUB NUMSUB updates
["updates",1]
# connection: default
> PUBLISH updates hello
1
# connection: subscriber
# receive pushed message
["message","updates","hello"]
# connection: subscriber
> UNSUBSCRIBE updates
["unsubscribe","updates",0]