Please explain Redis Pub/Sub Wire Protocol Example
In this Redis Pub/Sub topic
It says this:
"subscribe: means that we successfully subscribed to the channel given as the second element in the reply. The third argument represents the number of channels we are currently subscribed to."
And then it gives this Wire Pr开发者_开发问答otocol example:
SUBSCRIBE first second
*3
$9
subscribe
$5
first
:1
*3
$9
subscribe
$6
second
:2
What do the lines like *3 and $9 mean?
*3 means there are 3 parameters in the server's response.
$9 means that the first parameter is a string with nine characters in it, and the string itself will follow on the next line ("subscribe").
Same goes with $5 and "first".
:1 indicates an integer parameter with a value of 1.
Protocol details are available on the Redis website: http://redis.io/topics/protocol
精彩评论