Sitelet https://github.com/feuyeux/hello-websocket/tree/main/hello-websocket-python
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Hello WebSocket - Python Implementation

Python implementation of the Hello WebSocket protocol using websockets.

Project Structure

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

Prerequisites

  • Python 3.11+

Build

./scripts/build.sh

Or manually:

pip install -r requirements.txt
python -m pytest common/codec_test.py -v

Run Server

./scripts/run-server.sh

Environment variables:

  • WS_PORT — Port to listen on (default: 9898)
  • WS_PATH — WebSocket path (default: /ws)

Run Client

./scripts/run-client.sh

Environment variables:

  • WS_SERVER — Server host (default: 127.0.0.1)
  • WS_PORT — Server port (default: 9898)
  • WS_PATH — WebSocket path (default: /ws)

Protocol

See ../PROTOCOL.md for the canonical protocol specification.