Redis Commands
- A
- B
- Client
-
Cluster
- Cluster-addslots
- Cluster-addslotsrange
- Cluster-bumpepoch
- Cluster-count-failure-reports
- Cluster-countkeysinslot
- Cluster-delslots
- Cluster-delslotsrange
- Cluster-failover
- Cluster-flushslots
- Cluster-forget
- Cluster-getkeysinslot
- Cluster-help
- Cluster-info
- Cluster-keyslot
- Cluster-links
- Cluster-meet
- Cluster-myid
- Cluster-myshardid
- Cluster-nodes
- Cluster-replicas
- Cluster-replicate
- Cluster-reset
- Cluster-saveconfig
- Cluster-set-config-epoch
- Cluster-setslot
- Cluster-shards
- Cluster-slaves
- Cluster-slots
- Cluster
- Command
- Config
- D
- E
- F
- G
- H
- I
- K
- L
- M
- O
- P
- Q
- R
- S1
- S2
- T
- U
- W
- X
- Z1
- Z2
Docs > Redis Commands > P > Psubscribe
Subscribes the client to the given patterns.
Supported glob-style patterns:
h?llo
subscribes tohello
,hallo
andhxllo
h*llo
subscribes tohllo
andheeeello
h[ae]llo
subscribes tohello
andhallo,
but nothillo
Use \
to escape special characters if you want to match them verbatim.
Once the client enters the subscribed state it is not supposed to issue any other commands, except for additional SUBSCRIBE
, SSUBSCRIBE
, PSUBSCRIBE
, UNSUBSCRIBE
, SUNSUBSCRIBE
, PUNSUBSCRIBE
, PING
, RESET
and QUIT
commands.
However, if RESP3 is used (see HELLO
) it is possible for a client to issue any commands while in subscribed state.
For more information, see Pub/sub.
@return
When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string "psubscribe" is pushed as a confirmation that the command succeeded.
Behavior change history
>= 6.2.0
:RESET
can be called to exit subscribed state.