Redis Psubscribe Command

Redis Pub/Sub

The Redis Psubscribe command subscribes to one or more channels matching a given pattern.

Each pattern uses * as a wildcard, for example it* matches all channels starting with it (it.news, it.blog, it.tweets, etc.). news.* matches all channels starting with news. (news.it, news.global.today, etc.), and so on.

Syntax

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

redis 127.0.0.1:6379> PSUBSCRIBE pattern [pattern ...]

Available Versions

>= 2.0.0

Return Value

The received messages.

Examples

redis 127.0.0.1:6379> PSUBSCRIBE mychannel
Reading messages... (press Ctrl-C to quit)
1) "psubscribe"
2) "mychannel"
3) (integer) 1

Redis Pub/Sub

Other Extensions