Python implementation of the Hello WebSocket protocol using websockets.
hello-websocket-python/
├── requirements.txt # pip dependencies
├── common/
│ ├── __init__.py
│ ├── codec.py # Binary protocol codec
│ └── codec_test.py # Codec unit tests
├── server/
│ └── ws_server.py # WebSocket server
├── client/
│ └── ws_client.py # WebSocket client
├── scripts/
│ ├── build.sh # Install and test
│ ├── run-server.sh # Run server
│ └── run-client.sh # Run client
└── README.md
- Python 3.11+
./scripts/build.shOr manually:
pip install -r requirements.txt
python -m pytest common/codec_test.py -v./scripts/run-server.shEnvironment variables:
WS_PORT— Port to listen on (default: 9898)WS_PATH— WebSocket path (default: /ws)
./scripts/run-client.shEnvironment variables:
WS_SERVER— Server host (default: 127.0.0.1)WS_PORT— Server port (default: 9898)WS_PATH— WebSocket path (default: /ws)
See ../PROTOCOL.md for the canonical protocol specification.