I am trying develop a notifications system based on Python and Redis. I have been checking the python redis
module and I saw a small pattern subscribe example:
p.psubscribe('my-*', ...)
Theorically, that is the way, so I tried something similar
import redis
import time
r =redis.StrictRedis(host = 'localhost', port=6379, db=0)
p = r.pubsub()
p.psubscribe('*')
for msg in p.listen():
print time.time(), msg
time.sleep(0.001)
I am trying subscribe to every keys to made the example easiest. However, I only get this message at the first, and while I am changing the key's values I get nothing else.
1479469808.51 {'pattern': None, 'type': 'psubscribe', 'channel': '*', 'data': 1L}
I can see that pattern
is None, so I understand that I am not really subscribing. How deal I with it? Thanks.
There was a very simple mistake. The code worked well, but I have had to execute the following command in Redis
config set notify-keyspace-events KEA