Message Queuing Telemetry Transport (MQTT) is a lightweight pub/sub messaging protocol designed for minimal bandwidth and device resource requirements. This makes it ideal for IoT projects, where you generally have limited processing power and memory space (read more about MQTT).
There are several MQTT broker/server implementations out there (hopefully exhaustive list), however most of then cannot be ran on my QNAP TS221 Network Attached Storage because it uses a custom version of Linux and it is run by an ARM processor.
On the other hand, Moquette is a MQTT broker written in Java, so I gave it a try.
- Install the Java Runtime Environment for ARM – for some reason I could not find it in the App Center, so I had to download the package from here (dead link) and install it via the Install Manually button.
- SSH into the QNAP (guide)
- Follow the steps listed in the Moquette repo
- wget https://bintray.com/artifact/download/andsel/generic/distribution-0.8-bundle-tar.tar.gz –no-check-certificate
- tar xvfz distribution-0.8-bundle-tar.tar.gz
- By default Moquette uses port 8080 for WebSocket which is also used by the QNAP administration interface, so I changed the Moquette port to 9090 by navigating to /config and setting websocket_port to 9090 in moquette.conf
- navigate to /bin and run moquette.sh
- By now you should have a working MQTT broker, you can test it with this online tool.
- Optionally you can configure your moquette.sh to be run at startup