Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad38bfd

Browse files
author
zeekay
committed
Update README.
1 parent 5e840ea commit ad38bfd

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

README.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
Flask-uWSGI-WebSocket
22
=====================
33
High-performance WebSockets for your Flask apps powered by `uWSGI
4-
<http://uwsgi-docs.readthedocs.org/en/latest/>`_. Inspired by `Flask-Sockets
4+
<http://uwsgi-docs.readthedocs.org/en/latest/>`_. Low-level uWSGI WebSocket API
5+
access and flexible high-level abstractions for building complex WebSocket
6+
applications with Flask. Supports several different concurrency models
7+
including Gevent. Inspired by `Flask-Sockets
58
<https://github.com/kennethreitz/flask-sockets>`_.
69

710
.. code-block:: python
811
912
from flask import Flask
10-
from flask.ext.uwsgi_websocket import WebSocket
13+
from flask.ext.uwsgi_websocket import GeventWebSocket
1114
1215
app = Flask(__name__)
13-
ws = WebSocket(app)
16+
ws = GeventWebSocket(app)
1417
1518
@ws.route('/echo')
1619
def echo(ws):
@@ -19,30 +22,30 @@ High-performance WebSockets for your Flask apps powered by `uWSGI
1922
ws.send(message)
2023
2124
if __name__ == '__main__':
22-
app.run(debug=True, threads=16)
25+
app.run(gevent=100)
2326
2427
Installation
2528
------------
26-
To install Flask-uWSGI-WebSocket, simply::
29+
Preferred method of installation is via pip::
2730

2831
$ pip install Flask-uWSGI-WebSocket
2932

3033
Deployment
3134
----------
3235
You can use uWSGI's built-in HTTP router to get up and running quickly::
3336

34-
$ uwsgi --master --http :8080 --http-websockets --wsgi-file app.py
37+
$ uwsgi --master --http :8080 --http-websockets --wsgi echo:app
3538

36-
...or call ``app.run``, passing uwsgi any arguments you like::
39+
...which is what ``app.run`` does after wrapping your Flask app::
3740

3841
app.run(debug=True, host='localhost', port=8080, master=true, processes=8)
3942

4043
uWSGI supports several concurrency models, in particular it has nice support
4144
for Gevent. If you want to use Gevent, import
4245
``flask.ext.uwsgi_websocket.GeventWebSocket`` and configure uWSGI to use the
43-
gevent loop engine:
46+
gevent loop engine::
4447

45-
$ uwsgi --master --http :8080 --http-websockets --gevent 100 --wsgi-file app.py
48+
$ uwsgi --master --http :8080 --http-websockets --gevent 100 --wsgi echo:app
4649

4750
...or::
4851

@@ -66,8 +69,8 @@ werkzeug's ``DebuggedApplication`` middleware::
6669

6770
$ uwsgi --master --http :8080 --http-websockets --wsgi-file --workers 1 --threads 8 app.py
6871

69-
If you use ``app.run(debug=True)``, Flask-uWSGI-Websocket will do this
70-
automatically for you.
72+
If you use ``app.run(debug=True)`` or export ``FLASK_UWSGI_DEBUG``,
73+
Flask-uWSGI-Websocket will do this automatically for you.
7174

7275

7376
API

0 commit comments

Comments
 (0)