MQTT Real-time Support for MESHdesk and APdesk
Install Mosquitto
Install the Mosquitto MQTT Broker as per these fine instructions:
Make sure you do Step 3 to secure the it with usernames and passwords.
In this document we use username and password of openwrt. Please change according to your preference.
Install Rdcore-API-Gateway
The Rdcore-
API-Gateway is a Node.js application. We will start off by installing Node.js and npm.
sudo apt install nodejs
sudo apt install npm
cd /opt
Clone Rdcore
API Gateway from Github
sudo git clone https://github.com/RADIUSdesk/Rdcore-API-Gateway.git
cd /opt/Rdcore-API-Gateway
sudo npm install
sudo mv .env.sample .env
sudo vi .env
PORT=8001
#FQDN of your installed server
MESH_CONTROLLER="http://cloud.mesh-manager.com"
MQTT_BROKER="127.0.0.1"
MQTT_PORT=1883
MQTT_USER=openwrt
MQTT_PASS=openwrt
The Rdcore
API Gateway Systemd Startup File
sudo cp /opt/Rdcore-API-Gateway/rdcore-api-gateway.service /lib/systemd/system/
Enable the Rdcore
API Gateway
sudo systemctl enable rdcore-api-gateway.service
Start the Rdcore
API Gateway
sudo systemctl start rdcore-api-gateway.service
sudo systemctl status rdcore-api-gateway.service
MQTT Settings in RADIUSdesk
Command topic is always /RD/NODE/COMMAND/RESPONSE
Then for the server to use MQTT instead of the heartbeat system you have to edit the following config file.
Edit /var/www/html/cake4/rd_cake/config/MESHdesk.php
Look for this sections and adapt to your server's values.
$config['mqtt_settings']['enable_realtime'] = true;
$config['mqtt_settings']['api_gateway_url'] = 'http://164.160.89.129:8001';