Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit 83d1701

Browse files
committed
Merge pull request #28 from tian2992/master
Standalone running sample on README.rst
2 parents fd2a7b8 + 87e2594 commit 83d1701

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ Elegant WebSockets for your Flask apps.
2222
@app.route('/')
2323
def hello():
2424
return 'Hello World!'
25+
26+
27+
if __name__ == "__main__":
28+
from gevent import pywsgi
29+
from geventwebsocket.handler import WebSocketHandler
30+
server = pywsgi.WSGIServer(('', 5000), app, handler_class=WebSocketHandler)
31+
server.serve_forever()
32+
2533
2634
Serving WebSockets in Python was really difficult. Now it's not.
2735

@@ -44,6 +52,7 @@ A custom Gunicorn worker is included to make deployment as friendly as possible:
4452
Production services are provided by `gevent <http://www.gevent.org>`_
4553
and `gevent-websocket <http://www.gelens.org/code/gevent-websocket/>`_.
4654

55+
The given example can run standalone as main.
4756

4857
Anything that inserts ``wsgi.websocket`` into the WSGI environ is
4958
supported, but gevent-websocket is recommended.

0 commit comments

Comments
 (0)