Easy Tutorial
❮ Hashes Hkeys Keys Exists ❯

Redis Psubscribe Command

Redis Publish Subscribe

The Redis Psubscribe command subscribes to one or more channels that match the given patterns.

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

Syntax

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

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

Available Versions

= 2.0.0

Return Value

Received messages.

Example

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

Redis Publish Subscribe

❮ Hashes Hkeys Keys Exists ❯