Introduction
PSUBSCRIBE lets you listen to many channels at once by using patterns instead of exact names. This helps you get messages from groups of channels easily.
PSUBSCRIBE pattern [pattern ...]
PSUBSCRIBE news.*
PSUBSCRIBE *.updates
PSUBSCRIBE *chat*
PSUBSCRIBE sports.* news.*
redis-cli PSUBSCRIBE news.* # Then in another terminal: redis-cli PUBLISH news.sports "Sports news here" PUBLISH news.weather "Weather news here" PUBLISH chat.general "Hello chat" # The subscriber will receive messages only from channels matching 'news.*'
PSUBSCRIBE do?PSUBSCRIBE sports.* PUBLISH sports.football "Goal!" PUBLISH sports.basketball "Score!" PUBLISH news.weather "Rain"
PSUBSCRIBE sports.* but receive no messages when publishing to sports.football. What is the most likely mistake?Pass the test and this pattern moves unknown