Redis - PubSub Subscribe Command



Redis SUBSCRIBE command subscribes the client to the specified channels.

Syntax

Following is the basic syntax of Redis SUBSCRIBE command.

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

Return Value

Array reply.

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.htm
Advertisements