To run the most advanced examples and connect GPSS-Plus with the real world, you will need to install your own middleware.js and, optionally, the virtual OPC-UA device and microcontroller firmwares.
middleware.js : Version 1.03
The middleware acts as an intermediate layer between GPSS-Plus and physical sensors or actuators.
It must run in a Node.js environment with secure communication (HTTPS / WSS).
Prerequisites
- Node.js version 18 or higher.
- Valid SSL certificates (required for the secure channel).
- Network connectivity between GPSS-Plus and the OPC-UA or MQTT devices.
Certificate Installation
Depending on whether you run it on a private network or a public domain, there are two options:
a) Local Environment – using mkcert
Ideal for testing on internal networks.
Example for mkcert on Debian:
# Create a DNS entry in your domain pointing to your local IP. Example: ip11.yourdomain.com -> 192.168.1.11 # Install the libnss3-tools package sudo apt install libnss3-tools # Download mkcert wget https://github.com/FiloSottile/mkcert/releases/latest/download/mkcert-v1.4.4-linux-arm mv mkcert-v1.4.4-linux-arm /usr/local/bin/mkcert chmod +x /usr/local/bin/mkcert # Install the root certificate mkcert -install # Create the certificate for your specific subdomain: mkcert ip11.yourdomain.com 192.168.1.11 # Move certificates to a standard location: mkdir -p /etc/ssl/localcerts mv ip11.yourdomain.com+1.pem /etc/ssl/localcerts/ mv ip11.yourdomain.com+1-key.pem /etc/ssl/localcerts/
b) Public Server – using Let’s Encrypt
On servers accessible from the Internet, use real certificates from Let's Encrypt.
Edit middleware.js
Edit the middleware.js file to include the certificate paths:
const certOptions = {
cert: fs.readFileSync("/etc/letsencrypt/live/PATH_CHAIN/fullchain.pem"),
key: fs.readFileSync("/etc/letsencrypt/live/PATH_PRIVKEY/privkey.pem")
};
Run the installation of required libraries and start the service:
npm install express ws cors aedes node-opcua mysql2 serialport mqtt node middleware.js
Virtual OPC-UA : Version 1.0
This virtual OPC-UA server simulates a set of sensors and actuators, ideal for development and testing without physical hardware.
npm install node index.js
Expected output: OPC-UA running: opc.tcp://your.domain:4840
Firmware for ESP32 : Version 1.0
Basic firmware for ESP32 microcontrollers, designed to send temperature and humidity via MQTT.
- DHT11 / DHT22 sensor reading.
- Periodic publication to MQTT topics.
- Compatible with the middleware.js broker.
Firmware for ESP8266 : Version 1.0
Alternative simpler firmware that allows toggling an LED and reading DHT sensors via MQTT.