|
| 1 | +Socket.IO WSGI Examples |
| 2 | +======================= |
| 3 | + |
| 4 | +This directory contains example Socket.IO applications that work together with |
| 5 | +WSGI frameworks. These examples all use Flask to serve the client application to |
| 6 | +the web browser, but they should be easily adapted to use other WSGI compliant |
| 7 | +frameworks. |
| 8 | + |
| 9 | +app.py |
| 10 | +------ |
| 11 | + |
| 12 | +A basic "kitchen sink" type application that allows the user to experiment |
| 13 | +with most of the available features of the Socket.IO server. |
| 14 | + |
| 15 | +latency.py |
| 16 | +---------- |
| 17 | + |
| 18 | +A port of the latency application included in the official Engine.IO |
| 19 | +Javascript server. In this application the client sends *ping* messages to |
| 20 | +the server, which are responded by the server with a *pong*. The client |
| 21 | +measures the time it takes for each of these exchanges and plots these in real |
| 22 | +time to the page. |
| 23 | + |
| 24 | +This is an ideal application to measure the performance of the different |
| 25 | +asynchronous modes supported by the Socket.IO server. |
| 26 | + |
| 27 | +Running the Examples |
| 28 | +-------------------- |
| 29 | + |
| 30 | +To run these examples, create a virtual environment, install the requirements |
| 31 | +and then run:: |
| 32 | + |
| 33 | + $ python app.py |
| 34 | + |
| 35 | +or:: |
| 36 | + |
| 37 | + $ python latency.py |
| 38 | + |
| 39 | +You can then access the application from your web browser at |
| 40 | +``http://localhost:5000``. |
| 41 | + |
| 42 | +Near the top of the ``app.py`` and ``latency.py`` source files there is a |
| 43 | +``async_mode`` variable that can be edited to swich to the other asynchornous |
| 44 | +modes. Accepted values for ``async_mode`` are ``'threading'``, ``'eventlet'`` |
| 45 | +and ``'gevent'``. |
| 46 | + |
| 47 | +Note 1: when using the ``'eventlet'`` mode, the eventlet package must be |
| 48 | +installed in the virtual environment:: |
| 49 | + |
| 50 | + $ pip install eventlet |
| 51 | + |
| 52 | +Note 2: when using the ``'gevent'`` mode, the gevent and gevent-websocket |
| 53 | +packages must be installed in the virtual environment:: |
| 54 | + |
| 55 | + $ pip install gevent gevent-websocket |
0 commit comments