Redis publish and subscribe commands





1 PSUBSCRIBE pattern [pattern ...]
Subscribe to one or more channels matching the given pattern.
2 PUBSUB subcommand [argument [argument ...]]
View subscription and publishing system status.


3 PUBLISH channel message
sends the information to the specified channel.




4 PUNSUBSCRIBE [pattern [pattern ...]]
Unsubscribes all channels of the given pattern.


5 SUBSCRIBE channel [channel ...]
Subscribe to a given channel or channels for information.

6 UNSUBSCRIBE [channel [channel ...]]
means to unsubscribe from the given channel.


Simulate the next three clients, one server sends the service, start three clients at the same time, enter respectively: subscribe testchannel

Then, open another client, publish testchannel "just for test ...."

as shown in the figure below? : As long as the channel of the publisher client is executed, the three clients will immediately receive the published information





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326392756&siteId=291194637