Tornado Redis chat
redis is often described as an "in-memory persistent key-value store", but it's much more than that. One of its nicest features is its support for the Publish/Subscribe messaging paradigm
, which makes it easy to implement, for example, a chat server.
In order to learn how to use it, I decided to implement a chat server using Redis and Tornado. This is a classical exercise, and others have done the same: but their solution has some pitfalls that I tried to fix.
The code is forked from pelletier's, with some improvements:
- Support for the latest Python Redis's client redis-py version 2.6.9
- Thread-safety: using the only method in Tornado's IOLoop that is thread-safe
- Tested with Python 3.3
This is the code, available also on gist: