Redis unsubscribe
publish-subscribe, redis
Solution
By client, I believe they mean the list of clients here:
http://redis.io/clients
As someone who has consumed the hiredis client, I presume that this recommendation:
Once the client enters the subscribed state it is not supposed to issue any other commands, except for additional SUBSCRIBE, PSUBSCRIBE, UNSUBSCRIBE and PUNSUBSCRIBE commands.
on this page: http://redis.io/commands/subscribe applies only to those clients.
The redis-cli is among those clients. So, the comment is not an instruction for users of redis-cli.
Instead, redis-cli blocks waiting for messages on the bus (only to be unsubcribed via a ctrl+c).
If you were to use a different client (or more specifically, if you were implementing one), my guess is that you'd have to observe that convention so that it would be in a subscribed state (though the client wouldn't necessarily be blocking).
I think the documentation could be a little clearer to disambiguate that; however, the documentation is on the server itself and not the redis-cli application. You could, however, make the adjustment in the documentation repo and submit a pull request.
https://github.com/antirez/redis-doc/blob/master/commands/subscribe.md
Problem
Redis supports PUBSUB. Subscribing is easy enough: ``` redis 127.0.0.1:6379> subscribe foo Reading messages... (press Ctrl-C to quit) 1) "subscribe" 2) "foo" 3) (integer) 1 ``` However it seems impossible to unsubscribe, because while subscribing, the server does not accept commands. e.g. in the `redis-cli` client that ships with redis, control is not returned to the client, so if I type `unsubscribe` it doesn't go anywhere. This seems like either a blatant error in the documentation, the function, or a PEBKAC issue. What gives? Version: $ ./redis-server --version Redis server v=2.6.14 sha=00000000:0 malloc=libc bits=64