A notification service via WebSockets. Allows clients to connect, authenticate through a JWT token, and subscribe to events. Events are captured by a consumer and all subscribers are notified.
This project requires Python 3.12+.
Dependencies are managed by uv and should be installed.
The list of requirements is stored in pyproject.toml.
- When running in a container, do not forget to set WEBSOCKETS_HOSTin the environment variables. In most cases, it should be0.0.0.0.
- The app requires a JWT public key for authentication. It can be set using one of two options (if both are set, the app will not start):
- Environment variable JWT_PUBLIC_KEY. Ensure it has no newlines. Checkenv.examplefor the correct format.
- A file named jwt_public_key.peminside thesrcdirectory.
 
- Environment variable 
Install and activate a virtual environment:
uv venv
source venv/bin/activateSet environment variables
cp env.example ./src/.env  # default environment variablesInstall requirements:
make  # compile and install depsRun message broker:
docker compose up -dRun server:
cd python src/entrypoint.pyConnect to the server in cli:
python -m websockets ws://localhost:{% port %}/{% websockets_path % }Format code with ruff
make fmtRun linters
make lintRun tests
make testIf you need to set python version manually
docker build --build-arg "PYTHON_VERSION=3.11.6" --tag websocket-notifications .Preferred way is to use .python-version file
docker build --build-arg "PYTHON_VERSION=$(cat .python-version)" --tag websocket-notifications .