RamtinPRG / MQTT_based_protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Network Programming Over the MQTT Protocol

MQTT Logo
Essentially, MQTT is an application layer protocol developed by OASIS which is mostly used in IoT platforms, such as Azure IoT Hub, AWS IoT, and Google Cloud IoT, etc. Also IoT devices support this protocol for communication (e.g. Arduino, ESP32, Raspberry Pi, etc).

Architecture

This is the basic structure of the MQTT protocol:

MQTT Architecture

MQTT stands for Message Queue Telemetry Transport. It is a transport protocol which is used to send and receive messages between devices. It is a publish-subscribe protocol, which means that the devices can send messages to the broker and receive messages from the broker. The broker is a central device which is responsible for distributing the messages to the devices (Or queues, to be exact). The broker is also responsible for keeping the devices in sync. So, the devices can receive messages from the broker even if they are not connected to the network.

Getting started with the project

First of all, you can clone this github repository using the following command in your terminal:

git clone https://github.com/RamtinPRG/MQTT_based_protocol.git

Then you need to install the Python dependencies in requirements.txt file:

pip install -r requirements.txt

Details

This project is a smaller test of a hospital network. The hospital network consists of three devices:

  • central device
  • patient device
  • doctor device

The central device is used for sending messages to the other devices. The patient device has the resposibility for receiving messages from the central device and sending them to the doctor device. The doctor device receives messages from the patient device and sending them to the central device.

It's programmed in Python 3.9 and uses paho-mqtt library and Eclipse MQTT broker by Eclipse Foundation for the MQTT communication.

About


Languages

Language:Python 100.0%