mirror of
https://github.com/kennethreitz/flask-sockets.git
synced 2026-06-05 23:10:16 +00:00
Merge pull request #28 from tian2992/master
Standalone running sample on README.rst
This commit is contained in:
@@ -22,6 +22,14 @@ Elegant WebSockets for your Flask apps.
|
||||
@app.route('/')
|
||||
def hello():
|
||||
return 'Hello World!'
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from gevent import pywsgi
|
||||
from geventwebsocket.handler import WebSocketHandler
|
||||
server = pywsgi.WSGIServer(('', 5000), app, handler_class=WebSocketHandler)
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
Serving WebSockets in Python was really difficult. Now it's not.
|
||||
|
||||
@@ -44,6 +52,7 @@ A custom Gunicorn worker is included to make deployment as friendly as possible:
|
||||
Production services are provided by `gevent <http://www.gevent.org>`_
|
||||
and `gevent-websocket <http://www.gelens.org/code/gevent-websocket/>`_.
|
||||
|
||||
The given example can run standalone as main.
|
||||
|
||||
Anything that inserts ``wsgi.websocket`` into the WSGI environ is
|
||||
supported, but gevent-websocket is recommended.
|
||||
|
||||
Reference in New Issue
Block a user