Introduction to redis publish and subscribe function
Redis publish and subscribe function (publish/subscribe):
Channels: message queuing
Subscribe: subscribe to one or more queues
> help subscribe # View subscribe help
Example: subscribe to news channel
> subscribe news
Note: you can subscribe to multiple channels at the same time
Publish: send messages to the channel
> help @ pubsub # View publish help
Example: send a message to the news channel
> publish new hello
Psubscribe: pattern subscription-- > you can subscribe to more than one channel at a time using regular expressions
> psubscribe "new.i [to]"
Publish: send messages to the channel
> help @ pubsub # View publish help
Example: send a message to the news channel
> publish new hello
Unsubscribe: unsubscribe from previously subscribed channels