From 4da8bdd401e5c732272da1344061ad315aed8c40 Mon Sep 17 00:00:00 2001 From: kalmastenitin Date: Fri, 9 Sep 2022 12:25:18 +0530 Subject: [PATCH 1/2] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d61f3a8..3a82112 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# fastapi-socketio +# This is forked version of fastapi-socketio + +For original repo visit: https://github.com/pyropy/fastapi-socketio [![PyPI](https://img.shields.io/pypi/v/fastapi-socketio.svg)](https://pypi.org/project/fastapi-socketio/) [![Changelog](https://img.shields.io/github/v/release/pyropy/fastapi-socketio?label=changelog)](https://github.com/pyropy/fastapi-socketio/releases) @@ -82,4 +84,4 @@ Before running example make sure you have all dependencies installed. ## Contributors -For list of contributors please reefer to CONTRIBUTORS.md file in this repository. \ No newline at end of file +For list of contributors please refer to CONTRIBUTORS.md file in this repository. From 16e8a61e5bcf3c30785733fa7d35a862136478e4 Mon Sep 17 00:00:00 2001 From: kalmastenitin Date: Fri, 9 Sep 2022 13:24:21 +0530 Subject: [PATCH 2/2] add-client-example --- README.md | 6 ++++++ examples/client.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 examples/client.py diff --git a/README.md b/README.md index 3a82112..65a4f61 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,12 @@ To run the examples simply run: PYTHONPATH=. python examples/app.py ``` +Sample socketio client run: + +```bash +PYTHONPATH=. python examples/client.py +``` + Before running example make sure you have all dependencies installed. ## Contributors diff --git a/examples/client.py b/examples/client.py new file mode 100644 index 0000000..236691c --- /dev/null +++ b/examples/client.py @@ -0,0 +1,15 @@ +import socketio + +sio = socketio.Client() + +@sio.event +def connect(): + print("Connected!") + +@sio.on('test') +def on_message(data): + print('Message Received!') + print(data) + +sio.connect('http://127.0.0.1:8000/ws', socketio_path="/ws/socket.io", wait_timeout = 10) +sio.wait()