Metadata-Version: 1.1
Name: Flask-uWSGI-WebSocket
Version: 0.1.3
Summary: High-performance WebSockets for your Flask apps powered by uWSGI.
Home-page: https://github.com/zeekay/flask-uwsgi-websocket
Author: Zach Kelling
Author-email: zk@monoid.io
License: Copyright (c) 2012-2013 Zach Kelling

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Description: Flask-uWSGI-WebSocket
        =====================
        High-performance WebSockets for your Flask apps powered by `uWSGI
        <http://uwsgi-docs.readthedocs.org/en/latest/>`_.  Inspired by `Flask-Sockets
        <https://github.com/kennethreitz/flask-sockets>`_.
        
        .. code-block:: python
        
            from flask import Flask
            from flask.ext.uwsgi_websocket import WebSocket
        
            app = Flask(__name__)
            ws = WebSocket(app)
        
            @ws.route('/echo')
            def echo(ws):
                while True:
                    msg = ws.receive()
                    ws.send(message)
        
            if __name__ == '__main__':
                app.run(debug=True, threads=16)
        
        Installation
        ------------
        To install Flask-uWSGI-WebSocket, simply::
        
            $ pip install Flask-uWSGI-WebSocket
        
        Deployment
        ----------
        You can use uWSGI's built-in HTTP router to get up and running quickly::
        
            $ uwsgi --master --http :8080 --http-websockets --wsgi-file app.py
        
        ...or call ``app.run``, passing uwsgi any arguments you like::
        
            app.run(debug=True, host='localhost', port=8080, master=true, processes=8)
        
        uWSGI supports several concurrency models, in particular it has nice support
        for Gevent. If you want to use Gevent, import
        ``flask.ext.uwsgi_websocket.GeventWebSocket`` and configure uWSGI to use the
        gevent loop engine:
        
            $ uwsgi --master --http :8080 --http-websockets --gevent 100 --wsgi-file app.py
        
        ...or::
        
            app.run(debug=True, gevent=100)
        
        For production you'll probably want to run uWSGI behind Haproxy or nginx of
        course, instead of using the built-int HTTP router.  Explore the `uWSGI
        documentation <http://uwsgi-docs.readthedocs.org/en/latest/WebSockets.html>`_
        for more detail.
        
        
        Development
        -----------
        It's possible to take advantage of Flask's interactive debugger by installing
        werkzeug's ``DebuggedApplication`` middleware::
        
            from werkzeug.debug import DebuggedApplication
            app.wsgi_app = DebuggedApplication(app.wsgi_app, True)
        
        ...and running uWSGI with only a single worker::
        
            $ uwsgi --master --http :8080 --http-websockets --wsgi-file --workers 1 --threads 8 app.py
        
        If you use ``app.run(debug=True)``, Flask-uWSGI-Websocket will do this
        automatically for you.
        
        
        API
        ---
        Flask-uWSGI-Websocket automatically performs the WebSocket handshake for you
        and passes your route handler a websocket client exposing `uWSGI's WebSocket API
        <http://uwsgi-docs.readthedocs.org/en/latest/WebSockets.html#api>`_.
        
        ``websocket.recv()``
        
        ``websocket.send(msg)``
        
        ``websocket.send_binary(msg)``
        
        ``websocket.recv_nb()``
        
        ``websocket.send_from_sharedarea(id, pos)``
        
        ``websocket.send_binary_from_sharedarea(id, pos)``
        
        In addition there is a special ``websocket.receive()`` method which tries to
        make non-blocking calls simpler. When using the ``WebSocket`` plugin, it blocks
        making it appropriate for threaded or multiprocess concurrency models. When
        using ``GeventWebSocket`` it'll take advantage of gevent and make a
        non-blocking recv call. ``AsyncWebsocket`` should do roughly the same thing,
        but currently plain ``--async`` concurrency model is a bit buggy in uWSGI 2.0.
        
Keywords: uwsgi flask websockets
Platform: any
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
