https://github.com/braboj/demo-hvlp
MQTT protocol demo
https://github.com/braboj/demo-hvlp
protocol python simulator training
Last synced: 12 days ago
JSON representation
MQTT protocol demo
- Host: GitHub
- URL: https://github.com/braboj/demo-hvlp
- Owner: braboj
- License: mit
- Created: 2024-03-24T15:36:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-07-10T19:15:29.000Z (14 days ago)
- Last Synced: 2026-07-10T21:10:29.538Z (14 days ago)
- Topics: protocol, python, simulator, training
- Language: Python
- Homepage:
- Size: 544 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HVLP - Hilscher Variable Length Protocol
HVLP is a simple protocol for sending messages between clients and a broker. The protocol is
based on the MQTT protocol and is implemented in Python. The main focus of the project is to
demonstrate the use of OOP, SOLID principles, sockets and threading in Python.
## Features
- Connect to a broker
- Subscribe to a topic
- Publish to a topic
- Disconnect from a broker
- Support for multiple clients
## Requirements
- Python 3.7 or newer
- The dependencies in `requirements.txt` (currently just `six`)
Install them, ideally into a virtual environment:
```bash
python -m venv .venv
# Windows (PowerShell):
.venv\Scripts\Activate.ps1
# Linux / macOS:
source .venv/bin/activate
pip install -r requirements.txt
```
## Project Setup
### 1. Clone the HVLP project
Use a git client to clone the project from https://github.com/braboj/demo-hvlp
to a folder of your choice.
### 2. Go to the project folder
Type `cd ` and install the dependencies as shown under
[Requirements](#requirements).
### 3. Open a new command terminal for the broker
From the project root, start the broker:
```bash
python -m hvlp.broker
```
If the arguments are omitted, the default IP is `127.0.0.1` and the default
port is `65432`.
### 4. Open a new command terminal for a client
From the project root, start a client:
```bash
python -m hvlp.client
```
If the arguments are omitted, the default server address is `127.0.0.1` and the
default port is `65432`.
### 5. Connect the client to the broker
Type `connect` in the client console to connect to the broker

### 6. Subscribe the client to a topic
Type `subscribe test` in the client console to subscribe to a topic

### 7. Repeat steps 4-6 to add a second client

### 8. Publish to a topic
Type publish test 1 in one of the client consoles.

### 9. Get help how to use the application
Type `help` in the client console for more commands

### 10. Exit the applications
Type `quit` or press CTRL + C in a client console to exit the client. To exit the broker press
CTRL + C. There might be a slight delay (1-2 seconds) until the application ends.