5 changed files with 127 additions and 45 deletions
@ -1,49 +1,15 @@ |
|||||
Engine.IO Examples |
Socket.IO Examples |
||||
================== |
================== |
||||
|
|
||||
This directory contains example Engine.IO applications. |
This directory contains several example Socket.IO applications, organized by |
||||
|
directory: |
||||
|
|
||||
app.py |
wsgi |
||||
------ |
---- |
||||
|
|
||||
A basic "kitchen sink" type application that allows the user to experiment |
Examples that are compatible with the WSGI protocol and frameworks. |
||||
with most of the available features of the server. |
|
||||
|
|
||||
latency.py |
aiohttp |
||||
---------- |
------- |
||||
|
|
||||
A port of the latency application included in the official Engine.IO |
Examples that are compatible with the aiohttp framework for asyncio. |
||||
Javascript server. In this application the client sends *ping* messages to |
|
||||
the server, which are responded by the server with a *pong*. The client |
|
||||
measures the time it takes for each of these exchanges and plots these in real |
|
||||
time to the page. |
|
||||
|
|
||||
This is an ideal application to measure the performance of the different |
|
||||
asynchronous modes supported by the Socket.IO server. |
|
||||
|
|
||||
Running the Examples |
|
||||
-------------------- |
|
||||
|
|
||||
To run these examples using the default ``'threading'`` mode, create a virtual |
|
||||
environment, install the requirements and then run:: |
|
||||
|
|
||||
$ python app.py |
|
||||
|
|
||||
or:: |
|
||||
|
|
||||
$ python latency.py |
|
||||
|
|
||||
Near the top of the ``app.py`` and ``latency.py`` source files there is a |
|
||||
``async_mode`` variable that can be edited to swich to the other asynchornous |
|
||||
modes. Accepted values for ``async_mode`` are ``'threading'``, ``'eventlet'`` |
|
||||
and ``'gevent'``. |
|
||||
|
|
||||
Note 1: when using the ``'eventlet'`` mode, the eventlet package must be |
|
||||
installed in the virtual environment:: |
|
||||
|
|
||||
$ pip install eventlet |
|
||||
|
|
||||
Note 2: when using the ``'gevent'`` mode, the gevent and gevent-websocket |
|
||||
packages must be installed in the virtual environment:: |
|
||||
|
|
||||
$ pip install gevent gevent-websocket |
|
||||
|
@ -0,0 +1,39 @@ |
|||||
|
Socket.IO aiohttp Examples |
||||
|
========================== |
||||
|
|
||||
|
This directory contains example Socket.IO applications that are compatible with |
||||
|
asyncio and the aiohttp framework. These applications require Python 3.5 or |
||||
|
later. |
||||
|
|
||||
|
app.py |
||||
|
------ |
||||
|
|
||||
|
A basic "kitchen sink" type application that allows the user to experiment |
||||
|
with most of the available features of the Socket.IO server. |
||||
|
|
||||
|
latency.py |
||||
|
---------- |
||||
|
|
||||
|
A port of the latency application included in the official Engine.IO |
||||
|
Javascript server. In this application the client sends *ping* messages to |
||||
|
the server, which are responded by the server with a *pong*. The client |
||||
|
measures the time it takes for each of these exchanges and plots these in real |
||||
|
time to the page. |
||||
|
|
||||
|
This is an ideal application to measure the performance of the different |
||||
|
asynchronous modes supported by the Socket.IO server. |
||||
|
|
||||
|
Running the Examples |
||||
|
-------------------- |
||||
|
|
||||
|
To run these examples, create a virtual environment, install the requirements |
||||
|
and then run:: |
||||
|
|
||||
|
$ python app.py |
||||
|
|
||||
|
or:: |
||||
|
|
||||
|
$ python latency.py |
||||
|
|
||||
|
You can then access the application from your web browser at |
||||
|
``http://localhost:8080``. |
@ -0,0 +1,8 @@ |
|||||
|
aiohttp==1.3.1 |
||||
|
async-timeout==1.1.0 |
||||
|
chardet==2.3.0 |
||||
|
multidict==2.1.4 |
||||
|
python-engineio |
||||
|
python_socketio |
||||
|
six==1.10.0 |
||||
|
yarl==0.9.2 |
@ -0,0 +1,55 @@ |
|||||
|
Socket.IO WSGI Examples |
||||
|
======================= |
||||
|
|
||||
|
This directory contains example Socket.IO applications that work together with |
||||
|
WSGI frameworks. These examples all use Flask to serve the client application to |
||||
|
the web browser, but they should be easily adapted to use other WSGI compliant |
||||
|
frameworks. |
||||
|
|
||||
|
app.py |
||||
|
------ |
||||
|
|
||||
|
A basic "kitchen sink" type application that allows the user to experiment |
||||
|
with most of the available features of the Socket.IO server. |
||||
|
|
||||
|
latency.py |
||||
|
---------- |
||||
|
|
||||
|
A port of the latency application included in the official Engine.IO |
||||
|
Javascript server. In this application the client sends *ping* messages to |
||||
|
the server, which are responded by the server with a *pong*. The client |
||||
|
measures the time it takes for each of these exchanges and plots these in real |
||||
|
time to the page. |
||||
|
|
||||
|
This is an ideal application to measure the performance of the different |
||||
|
asynchronous modes supported by the Socket.IO server. |
||||
|
|
||||
|
Running the Examples |
||||
|
-------------------- |
||||
|
|
||||
|
To run these examples, create a virtual environment, install the requirements |
||||
|
and then run:: |
||||
|
|
||||
|
$ python app.py |
||||
|
|
||||
|
or:: |
||||
|
|
||||
|
$ python latency.py |
||||
|
|
||||
|
You can then access the application from your web browser at |
||||
|
``http://localhost:5000``. |
||||
|
|
||||
|
Near the top of the ``app.py`` and ``latency.py`` source files there is a |
||||
|
``async_mode`` variable that can be edited to swich to the other asynchornous |
||||
|
modes. Accepted values for ``async_mode`` are ``'threading'``, ``'eventlet'`` |
||||
|
and ``'gevent'``. |
||||
|
|
||||
|
Note 1: when using the ``'eventlet'`` mode, the eventlet package must be |
||||
|
installed in the virtual environment:: |
||||
|
|
||||
|
$ pip install eventlet |
||||
|
|
||||
|
Note 2: when using the ``'gevent'`` mode, the gevent and gevent-websocket |
||||
|
packages must be installed in the virtual environment:: |
||||
|
|
||||
|
$ pip install gevent gevent-websocket |
@ -1,2 +1,16 @@ |
|||||
python-engineio==0.6.5 |
appdirs==1.4.0 |
||||
six==1.9.0 |
click==6.7 |
||||
|
enum-compat==0.0.2 |
||||
|
enum34==1.1.6 |
||||
|
eventlet==0.20.1 |
||||
|
Flask==0.12 |
||||
|
greenlet==0.4.12 |
||||
|
itsdangerous==0.24 |
||||
|
Jinja2==2.9.5 |
||||
|
MarkupSafe==0.23 |
||||
|
packaging==16.8 |
||||
|
pyparsing==2.1.10 |
||||
|
python-engineio |
||||
|
python-socketio |
||||
|
six==1.10.0 |
||||
|
Werkzeug==0.11.15 |
||||
|
Loading…
Reference in new issue