|
79 | 79 | --- |
80 | 80 | ``flask_uwsgi_websocket.WebSocket`` |
81 | 81 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
82 | | -``WebSocketMiddleware`` automatically performs WebSocket handshake and passes a ``WebSocketClient`` |
83 | | -instance to your route. |
| 82 | +Applies ``WebSocketMiddleware`` to your Flask App, allowing you to decorate |
| 83 | +routes with the ``route`` method, turning them into WebSocket handlers. |
| 84 | + |
| 85 | +Additionally monkey-patches ``app.run``, to run your app directly in uWSGI. |
| 86 | + |
| 87 | +``route(url)`` |
| 88 | + |
| 89 | +``run(debug, host, port, **kwargs)`` |
| 90 | +``**kwargs`` are passed to uWSGI as command line arguments. |
84 | 91 |
|
85 | 92 |
|
86 | 93 | ``flask_uwsgi_websocket.WebSocketMiddleware`` |
87 | 94 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
88 | | -WebSocket Middleware used by ``WebSocket``. |
| 95 | +WebSocket Middleware which automatically performs WebSocket handshake and |
| 96 | +passes ``WebSocketClient`` instances to your route. |
89 | 97 |
|
90 | 98 |
|
91 | 99 | ``flask_uwsgi_websocket.WebSocketClient`` |
92 | 100 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
93 | 101 | Exposes the `uWSGI WebSocket API |
94 | 102 | <http://uwsgi-docs.readthedocs.org/en/latest/WebSockets.html#api>`_. |
95 | 103 |
|
96 | | -``WebSocket.recv()`` (alias ``WebSocket.receive()``) |
| 104 | +``recv()`` (alias ``WebSocket.receive()``) |
97 | 105 |
|
98 | | -``WebSocket.recv_nb()`` |
| 106 | +``recv_nb()`` |
99 | 107 |
|
100 | | -``WebSocket.send(msg)`` |
| 108 | +``send(msg)`` |
101 | 109 |
|
102 | | -``WebSocket.send_binary(msg)`` |
| 110 | +``send_binary(msg)`` |
103 | 111 |
|
104 | | -``WebSocket.recv_nb()`` |
| 112 | +``recv_nb()`` |
105 | 113 |
|
106 | | -``WebSocket.send_from_sharedarea(id, pos)`` |
| 114 | +``send_from_sharedarea(id, pos)`` |
107 | 115 |
|
108 | | -``WebSocket.send_binary_from_sharedarea(id, pos)`` |
| 116 | +``send_binary_from_sharedarea(id, pos)`` |
109 | 117 |
|
110 | 118 |
|
111 | 119 | ``flask_uwsgi_websocket.GeventWebSocket`` |
112 | 120 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
113 | 121 | Fancier WebSocket abstraction that takes advantage of Gevent loop engine. |
114 | | -``GeventWebSocketMiddleware`` automatically performs WebSocket handshake and |
115 | | -passes a ``GeventWebSocketClient`` instance to your route. Requires uWSGI to |
116 | | -be run with ``--uwsgi`` option. |
| 122 | +Requires uWSGI to be run with ``--uwsgi`` option. |
117 | 123 |
|
118 | 124 |
|
119 | 125 | ``flask_uwsgi_websocket.GeventWebSocketMiddleware`` |
120 | 126 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
121 | | -WebSocket Middleware used by ``GeventWebSocket``. |
| 127 | +Automatically performs WebSocket handshake and passes a ``GeventWebSocketClient`` instance to your route. |
122 | 128 |
|
123 | 129 |
|
124 | 130 | ``flask_uwsgi_websocket.GeventWebSocketClient`` |
125 | 131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
126 | 132 | WebSocket client abstraction with fully non-blocking methods. |
127 | 133 |
|
128 | | -``websocket.receive()`` |
| 134 | +``receive()`` |
129 | 135 |
|
130 | | -``websocket.send(msg)`` |
| 136 | +``send(msg)`` |
131 | 137 |
|
132 | | -``websocket.close()`` |
| 138 | +``close()`` |
133 | 139 |
|
134 | | -``websocket.connected`` |
| 140 | +``connected`` |
0 commit comments