Redis Subscribe Command

Redis Pub/Sub

The Redis Subscribe command is used to subscribe to information of one or more given channels.

Syntax

The basic syntax of the redis Subscribe command is as follows:

redis 127.0.0.1:6379> SUBSCRIBE channel [channel ...]

Available versions

>= 2.0.0

Return value

Received information

Example

redis 127.0.0.1:6379> SUBSCRIBE mychannel 
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "mychannel"
3) (integer) 1
1) "message"
2) "mychannel"
3) "a"

Redis Pub/Sub

Other extensions