Redis Publish Command

Redis Pub/Sub

The Redis Publish command is used to send messages to a specified channel.

Syntax

The basic syntax of the Redis Publish command is as follows:

redis 127.0.0.1:6379> PUBLISH channel message

Available Versions

>= 2.0.0

Return Value

The number of subscribers that received the message.

Examples

redis 127.0.0.1:6379> PUBLISH mychannel "hello, i m here"
(integer) 1

Redis Pub/Sub

Other Extensions