[Python-modules-commits] [django-websocket-redis] 01/06: Import django-websocket-redis_0.4.6.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Fri Feb 19 11:58:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository django-websocket-redis.

commit 0dd8e5d7f048ca60bc03b7c0f62b32b37721e663
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Feb 19 12:29:50 2016 +0100

    Import django-websocket-redis_0.4.6.orig.tar.gz
---
 PKG-INFO                                     | 96 +++++++++++-----------------
 README.md                                    |  2 +-
 django_websocket_redis.egg-info/PKG-INFO     | 96 +++++++++++-----------------
 django_websocket_redis.egg-info/requires.txt |  6 +-
 ws4redis/__init__.py                         |  2 +-
 ws4redis/django_runserver.py                 |  5 +-
 ws4redis/websocket.py                        |  5 +-
 ws4redis/wsgi_server.py                      |  4 +-
 8 files changed, 87 insertions(+), 129 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index ade0da2..74841e6 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-websocket-redis
-Version: 0.4.5
+Version: 0.4.6
 Summary: Websocket support for Django using Redis as datastore
 Home-page: https://github.com/jrief/django-websocket-redis
 Author: Jacob Rief
@@ -11,90 +11,66 @@ Description: django-websocket-redis
         
         Project home: https://github.com/jrief/django-websocket-redis
         
-        Detailed documentation on
-        `ReadTheDocs <http://django-websocket-redis.readthedocs.org/en/latest/>`__.
+        Detailed documentation on [ReadTheDocs](http://django-websocket-redis.readthedocs.org/en/latest/).
         
-        Online demo: http://websocket.aws.awesto.com/
+        Online demo: http://django-websocket-redis.awesto.com/
         
         Websockets for Django using Redis as message queue
         --------------------------------------------------
+        This module implements websockets on top of Django without requiring any additional framework. For
+        messaging it uses the [Redis](http://redis.io/) datastore and in a production environment, it is
+        intended to work under [uWSGI](http://projects.unbit.it/uwsgi/) and behind [NGiNX](http://nginx.com/)
+        or [Apache](http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html) version 2.4.5 or later.
         
-        This module implements websockets on top of Django without requiring any
-        additional framework. For messaging it uses the
-        `Redis <http://redis.io/>`__ datastore and in a production environment,
-        it is intended to work under `uWSGI <http://projects.unbit.it/uwsgi/>`__
-        and behind `NGiNX <http://nginx.com/>`__ or
-        `Apache <http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html>`__
-        version 2.4.5 or later.
         
         New in 0.4.5
         ------------
+        * Created 1 requirements file under ``examples/chatserver/requirements.txt``.
+        * Renamed chatclient.py to test_chatclient.py - for django-nose testrunner.
+        * Migrated example project to django 1.7.
+        * Edited ``docs/testing.rst`` to show new changes for using example project.
+        * Added support for Python 3.3 and 3.4.
+        * Added support for Django-1.8
+        * Removes the check for middleware by name.
         
-        -  Created 1 requirements file under
-           ``examples/chatserver/requirements.txt``.
-        -  Renamed chatclient.py to test\_chatclient.py - for django-nose
-           testrunner.
-        -  Migrated example project to django 1.7.
-        -  Edited ``docs/testing.rst`` to show new changes for using example
-           project.
-        -  Added support for Python 3.3 and 3.4.
-        -  Added support for Django-1.8
-        -  Removes the check for middleware by name.
         
         Features
         --------
-        
-        -  Largely scalable for Django applications with many hundreds of open
-           websocket connections.
-        -  Runs a seperate Django main loop in a cooperative concurrency model
-           using `gevent <http://www.gevent.org/>`__, thus only one
-           thread/process is required to control *all* open websockets
-           simultaneously.
-        -  Full control over this seperate main loop during development, so
-           **Django** can be started as usual with ``./manage.py runserver``.
-        -  No dependency to any other asynchronous event driven framework, such
-           as Tornado, Twisted or Socket.io/Node.js.
-        -  Normal Django requests communicate with this seperate main loop
-           through **Redis** which, by the way is a good replacement for
-           memcached.
-        -  Optionally persiting messages, allowing server reboots and client
-           reconnections.
-        
-        If unsure, if this proposed architecture is the correct approach on how
-        to integrate Websockets with Django, then please read Roberto De Ioris
-        (BDFL of uWSGI) article about `Offloading Websockets and Server-Sent
-        Events AKA “Combine them with Django
-        safely” <http://uwsgi-docs.readthedocs.org/en/latest/articles/OffloadingWebsocketsAndSSE.html>`__.
-        
-        Please also consider, that whichever alternative technology you use, you
-        always need a message queue, so that the Django application can “talk”
-        to the browser. This is because the only link between the browser and
-        the server is through the Websocket and thus, by definition a long
-        living connection. For scalability reasons you can't start a Django
-        server thread for each of these connections.
+        * Largely scalable for Django applications with many hundreds of open websocket connections.
+        * Runs a seperate Django main loop in a cooperative concurrency model using [gevent](http://www.gevent.org/),
+          thus only one thread/process is required to control *all* open websockets simultaneously.
+        * Full control over this seperate main loop during development, so **Django** can be started as usual with
+          ``./manage.py runserver``.
+        * No dependency to any other asynchronous event driven framework, such as Tornado, Twisted or
+          Socket.io/Node.js.
+        * Normal Django requests communicate with this seperate main loop through **Redis** which, by the way is a good
+          replacement for memcached.
+        * Optionally persiting messages, allowing server reboots and client reconnections.
+        
+        If unsure, if this proposed architecture is the correct approach on how to integrate Websockets with Django, then
+        please read Roberto De Ioris (BDFL of uWSGI) article about
+        [Offloading Websockets and Server-Sent Events AKA “Combine them with Django safely”](http://uwsgi-docs.readthedocs.org/en/latest/articles/OffloadingWebsocketsAndSSE.html).
+        
+        Please also consider, that whichever alternative technology you use, you always need a message queue,
+        so that the Django application can “talk” to the browser. This is because the only link between the browser and
+        the server is through the Websocket and thus, by definition a long living connection. For scalability reasons you
+        can't start a Django server thread for each of these connections.
         
         Build status
         ------------
-        
-        |Build Status| |Downloads|
+        [![Build Status](https://travis-ci.org/jrief/django-websocket-redis.png?branch=master)](https://travis-ci.org/jrief/django-websocket-redis)
+        [![Downloads](http://img.shields.io/pypi/dm/django-websocket-redis.svg?style=flat-square)](https://pypi.python.org/pypi/django-websocket-redis/)
         
         Questions
         ---------
-        
         Please use the issue tracker to ask questions.
         
         License
         -------
-        
-        Copyright © 2015 Jacob Rief.
+        Copyright © 2015 Jacob Rief.
         
         MIT licensed.
         
-        .. |Build Status| image:: https://travis-ci.org/jrief/django-websocket-redis.png?branch=master
-           :target: https://travis-ci.org/jrief/django-websocket-redis
-        .. |Downloads| image:: http://img.shields.io/pypi/dm/django-websocket-redis.svg?style=flat-square
-           :target: https://pypi.python.org/pypi/django-websocket-redis/
-        
 Keywords: django,websocket,redis
 Platform: OS Independent
 Classifier: Environment :: Web Environment
diff --git a/README.md b/README.md
index 2892225..7c11c74 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ Project home: https://github.com/jrief/django-websocket-redis
 
 Detailed documentation on [ReadTheDocs](http://django-websocket-redis.readthedocs.org/en/latest/).
 
-Online demo: http://websocket.aws.awesto.com/
+Online demo: http://django-websocket-redis.awesto.com/
 
 Websockets for Django using Redis as message queue
 --------------------------------------------------
diff --git a/django_websocket_redis.egg-info/PKG-INFO b/django_websocket_redis.egg-info/PKG-INFO
index ade0da2..74841e6 100644
--- a/django_websocket_redis.egg-info/PKG-INFO
+++ b/django_websocket_redis.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-websocket-redis
-Version: 0.4.5
+Version: 0.4.6
 Summary: Websocket support for Django using Redis as datastore
 Home-page: https://github.com/jrief/django-websocket-redis
 Author: Jacob Rief
@@ -11,90 +11,66 @@ Description: django-websocket-redis
         
         Project home: https://github.com/jrief/django-websocket-redis
         
-        Detailed documentation on
-        `ReadTheDocs <http://django-websocket-redis.readthedocs.org/en/latest/>`__.
+        Detailed documentation on [ReadTheDocs](http://django-websocket-redis.readthedocs.org/en/latest/).
         
-        Online demo: http://websocket.aws.awesto.com/
+        Online demo: http://django-websocket-redis.awesto.com/
         
         Websockets for Django using Redis as message queue
         --------------------------------------------------
+        This module implements websockets on top of Django without requiring any additional framework. For
+        messaging it uses the [Redis](http://redis.io/) datastore and in a production environment, it is
+        intended to work under [uWSGI](http://projects.unbit.it/uwsgi/) and behind [NGiNX](http://nginx.com/)
+        or [Apache](http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html) version 2.4.5 or later.
         
-        This module implements websockets on top of Django without requiring any
-        additional framework. For messaging it uses the
-        `Redis <http://redis.io/>`__ datastore and in a production environment,
-        it is intended to work under `uWSGI <http://projects.unbit.it/uwsgi/>`__
-        and behind `NGiNX <http://nginx.com/>`__ or
-        `Apache <http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html>`__
-        version 2.4.5 or later.
         
         New in 0.4.5
         ------------
+        * Created 1 requirements file under ``examples/chatserver/requirements.txt``.
+        * Renamed chatclient.py to test_chatclient.py - for django-nose testrunner.
+        * Migrated example project to django 1.7.
+        * Edited ``docs/testing.rst`` to show new changes for using example project.
+        * Added support for Python 3.3 and 3.4.
+        * Added support for Django-1.8
+        * Removes the check for middleware by name.
         
-        -  Created 1 requirements file under
-           ``examples/chatserver/requirements.txt``.
-        -  Renamed chatclient.py to test\_chatclient.py - for django-nose
-           testrunner.
-        -  Migrated example project to django 1.7.
-        -  Edited ``docs/testing.rst`` to show new changes for using example
-           project.
-        -  Added support for Python 3.3 and 3.4.
-        -  Added support for Django-1.8
-        -  Removes the check for middleware by name.
         
         Features
         --------
-        
-        -  Largely scalable for Django applications with many hundreds of open
-           websocket connections.
-        -  Runs a seperate Django main loop in a cooperative concurrency model
-           using `gevent <http://www.gevent.org/>`__, thus only one
-           thread/process is required to control *all* open websockets
-           simultaneously.
-        -  Full control over this seperate main loop during development, so
-           **Django** can be started as usual with ``./manage.py runserver``.
-        -  No dependency to any other asynchronous event driven framework, such
-           as Tornado, Twisted or Socket.io/Node.js.
-        -  Normal Django requests communicate with this seperate main loop
-           through **Redis** which, by the way is a good replacement for
-           memcached.
-        -  Optionally persiting messages, allowing server reboots and client
-           reconnections.
-        
-        If unsure, if this proposed architecture is the correct approach on how
-        to integrate Websockets with Django, then please read Roberto De Ioris
-        (BDFL of uWSGI) article about `Offloading Websockets and Server-Sent
-        Events AKA “Combine them with Django
-        safely” <http://uwsgi-docs.readthedocs.org/en/latest/articles/OffloadingWebsocketsAndSSE.html>`__.
-        
-        Please also consider, that whichever alternative technology you use, you
-        always need a message queue, so that the Django application can “talk”
-        to the browser. This is because the only link between the browser and
-        the server is through the Websocket and thus, by definition a long
-        living connection. For scalability reasons you can't start a Django
-        server thread for each of these connections.
+        * Largely scalable for Django applications with many hundreds of open websocket connections.
+        * Runs a seperate Django main loop in a cooperative concurrency model using [gevent](http://www.gevent.org/),
+          thus only one thread/process is required to control *all* open websockets simultaneously.
+        * Full control over this seperate main loop during development, so **Django** can be started as usual with
+          ``./manage.py runserver``.
+        * No dependency to any other asynchronous event driven framework, such as Tornado, Twisted or
+          Socket.io/Node.js.
+        * Normal Django requests communicate with this seperate main loop through **Redis** which, by the way is a good
+          replacement for memcached.
+        * Optionally persiting messages, allowing server reboots and client reconnections.
+        
+        If unsure, if this proposed architecture is the correct approach on how to integrate Websockets with Django, then
+        please read Roberto De Ioris (BDFL of uWSGI) article about
+        [Offloading Websockets and Server-Sent Events AKA “Combine them with Django safely”](http://uwsgi-docs.readthedocs.org/en/latest/articles/OffloadingWebsocketsAndSSE.html).
+        
+        Please also consider, that whichever alternative technology you use, you always need a message queue,
+        so that the Django application can “talk” to the browser. This is because the only link between the browser and
+        the server is through the Websocket and thus, by definition a long living connection. For scalability reasons you
+        can't start a Django server thread for each of these connections.
         
         Build status
         ------------
-        
-        |Build Status| |Downloads|
+        [![Build Status](https://travis-ci.org/jrief/django-websocket-redis.png?branch=master)](https://travis-ci.org/jrief/django-websocket-redis)
+        [![Downloads](http://img.shields.io/pypi/dm/django-websocket-redis.svg?style=flat-square)](https://pypi.python.org/pypi/django-websocket-redis/)
         
         Questions
         ---------
-        
         Please use the issue tracker to ask questions.
         
         License
         -------
-        
-        Copyright © 2015 Jacob Rief.
+        Copyright © 2015 Jacob Rief.
         
         MIT licensed.
         
-        .. |Build Status| image:: https://travis-ci.org/jrief/django-websocket-redis.png?branch=master
-           :target: https://travis-ci.org/jrief/django-websocket-redis
-        .. |Downloads| image:: http://img.shields.io/pypi/dm/django-websocket-redis.svg?style=flat-square
-           :target: https://pypi.python.org/pypi/django-websocket-redis/
-        
 Keywords: django,websocket,redis
 Platform: OS Independent
 Classifier: Environment :: Web Environment
diff --git a/django_websocket_redis.egg-info/requires.txt b/django_websocket_redis.egg-info/requires.txt
index fd488c1..093a791 100644
--- a/django_websocket_redis.egg-info/requires.txt
+++ b/django_websocket_redis.egg-info/requires.txt
@@ -7,8 +7,8 @@ six
 [django-redis-sessions]
 django-redis-sessions>=0.4.0
 
-[uwsgi]
-uWSGI>=1.9.20
-
 [wsaccel]
 wsaccel>=0.6.2
+
+[uwsgi]
+uWSGI>=1.9.20
\ No newline at end of file
diff --git a/ws4redis/__init__.py b/ws4redis/__init__.py
index 9550b82..ebb2c73 100644
--- a/ws4redis/__init__.py
+++ b/ws4redis/__init__.py
@@ -1,2 +1,2 @@
 # -*- coding: utf-8 -*-
-__version__ = '0.4.5'
+__version__ = '0.4.6'
diff --git a/ws4redis/django_runserver.py b/ws4redis/django_runserver.py
index 4cb3ff8..57d48af 100644
--- a/ws4redis/django_runserver.py
+++ b/ws4redis/django_runserver.py
@@ -49,8 +49,11 @@ class WebsocketRunServer(WebsocketWSGIServer):
             ('Upgrade', 'websocket'),
             ('Connection', 'Upgrade'),
             ('Sec-WebSocket-Accept', sec_ws_accept),
-            ('Sec-WebSocket-Version', str(websocket_version)),
+            ('Sec-WebSocket-Version', str(websocket_version))
         ]
+        if environ.get('HTTP_SEC_WEBSOCKET_PROTOCOL') is not None:
+            headers.append(('Sec-WebSocket-Protocol', environ.get('HTTP_SEC_WEBSOCKET_PROTOCOL')))
+
         logger.debug('WebSocket request accepted, switching protocols')
         start_response(force_str('101 Switching Protocols'), headers)
         six.get_method_self(start_response).finish_content()
diff --git a/ws4redis/websocket.py b/ws4redis/websocket.py
index 6981c19..2104ed7 100644
--- a/ws4redis/websocket.py
+++ b/ws4redis/websocket.py
@@ -98,8 +98,9 @@ class WebSocket(object):
             raise WebSocketError('Invalid close frame: {0} {1}'.format(header, payload))
         rv = payload[:2]
         if six.PY2:
-            rv = str(rv)
-        code = struct.unpack('!H', rv[0])
+            code = struct.unpack('!H', str(rv))[0]
+        else:
+            code = struct.unpack('!H', bytes(rv))[0]
         payload = payload[2:]
         if payload:
             validator = Utf8Validator()
diff --git a/ws4redis/wsgi_server.py b/ws4redis/wsgi_server.py
index eafb266..20a8a31 100644
--- a/ws4redis/wsgi_server.py
+++ b/ws4redis/wsgi_server.py
@@ -112,7 +112,9 @@ class WebsocketWSGIServer(object):
                             websocket.send(sendmsg)
                     else:
                         logger.error('Invalid file descriptor: {0}'.format(fd))
-                if private_settings.WS4REDIS_HEARTBEAT:
+                # Check again that the websocket is closed before sending the heartbeat,
+                # because the websocket can closed previously in the loop.
+                if private_settings.WS4REDIS_HEARTBEAT and not websocket.closed:
                     websocket.send(private_settings.WS4REDIS_HEARTBEAT)
         except WebSocketError as excpt:
             logger.warning('WebSocketError: {}'.format(excpt), exc_info=sys.exc_info())

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-websocket-redis.git



More information about the Python-modules-commits mailing list