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

Client example addition #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -78,8 +80,14 @@ 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

For list of contributors please reefer to CONTRIBUTORS.md file in this repository.
For list of contributors please refer to CONTRIBUTORS.md file in this repository.
15 changes: 15 additions & 0 deletions examples/client.py
Original file line number Diff line number Diff line change
@@ -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()