Redis – PubSub Subscribe Command

  • Post author:
  • Post category:Redis
  • Post comments:1 Comment

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"

This Post Has One Comment

Leave a Reply