The intent of this project is to just play around with WebSockets in Python and testing it with k6.
Some other stuff that I learned a bit on this project:
- Asyncio
- Testing with pytest
- Pydantic
- Dependency management with Poetry
- CI/CD with GitHub actions
- Python 3.9 (maybe it works with Python 3.7 and 3.8 but I won't test it)
- Docker and DockerCompose
- Node 14 (again, maybe it works with other versions)
- Yarn
-
Clone the repo
-
Install Poetry dependencies
poetry install -
Install pre-commit hooks
pre-commit install pre-commit install -t pre-push
Run run.sh
-
Connect via WebSocket
-
Send a message subscribing to a stream. Available streams:
default,even,odd{ "action": "subscribe" , "stream": "even" } -
Now you'll receive all entries for the stream you have subscribed
-
(Optional) Send a message unsubscribe from a stream:
{ "action": "unsubscribe" , "stream": "even" }