mattupstate/gevent-socketio-tutorial — pull request #1 by mmautner (2013-07-07 15:51:31+00:00)
Title: Allow multiple clients to listen on pubsub

I've ran your demo but two tracebacks occurred when I opened two connections to http://localhost:5000:

```python
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/Users/max/code/github/gevent-socketio-tutorial/app/__init__.py", line 61, in listener
for m in pubsub.listen():
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/redis/client.py", line 1673, in listen
r = self.parse_response()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/redis/client.py", line 1617, in parse_response
response = self.connection.read_response()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/redis/connection.py", line 309, in read_response
response = self._parser.read_response()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/redis/connection.py", line 143, in read_response
response = [self.read_response() for i in xrange(length)]
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/redis/connection.py", line 104, in read_response
response = self.read()
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/redis/connection.py", line 89, in read
return self._fp.readline()[:-2]
AttributeError: 'NoneType' object has no attribute 'readline'
>> failed with AttributeError
```

Currently, a single redis pubsub connection is created only once--at the time the Flask app is initialized--and it isn't reusable across socket.io client connections. My hasty solution is to create a redis pubsub connection for every socket.io client.