Simple Message Queue (SMQ) is an easy to use "Internet of Things" IoT / M2M "Machine-to-Machine" publish subscribe (pub/sub) connectivity protocol. SMQ is similar to MQTT and many other pub/sub protocols in that a broker manages all message transactions. The SMQ broker is an integral part of the Mako Server thus enabling bridging with any other protocol supported by the Mako Server.
The SMQ protocol enables easy communication between any product designed in any of the above listed computer languages, but can also easily be bridged with any of the other protocols supported by the Mako Server.
Source Code
The SMQ Java and C/C++ stacks are available on GitHub. The C code includes porting for many embedded environments. See the SMQ source code page for details.
The SMQ broker is implemented in Lua and runs on the Mako Server's asynchronous non blocking socket engine. The SMQ JavaScript library is included in the Mako Server's resource file mako.zip and is typically loaded on demand by browsers.
We provide several tutorials on the tutorials page. In particular, we recommend reading the online documentation and the following tutorials:
The SMQ broker is included in the Mako Server and can run on anything from a small device such as a Raspberry Pi to online cloud servers.
Use SMQ if you care about the environment and the carbon emission impact created by CPU intensive software which demands ever more data centers. Every year, millions of data centers worldwide are purging metric tons of hardware, draining country-sized amounts of electricity, and generating carbon emissions as much as the global airline industry. By using SMQ you not only help save the environment, but your own IoT cloud services cost.
See the tutorial Setting up an Environmentally Friendly IoT Server for details.
The following animated GIF image shows how to use the Java, JavaScript, and C Code LED (light) IoT example setup.
See the SMQ home page at Real Time Logic for interactive online examples.
The Christmas Light Controller is a fun project that lets you provide public access to your outdoor lights during the holiday season. Perfect for homeowners, parties, café, restaurants, and church displays to let visitors select a number of lighting transitions.
SMQ supports High Availability (HA) and lets you easily set up a very cost effective IoT HA cluster solution online. An SMQ HA cluster can be configured with or without a load balancer. See the interactive IoT HA cluster article for details.
SMQ and MQTT are publish/subscribe protocols that deliver asynchronous messages via a broker. Both protocols are microcontroller friendly and both implementations are lightweight, with SMQ being slightly lighter.
Both protocols facilities pub/sub messaging, but beyond that, SMQ provides a much richer set of messaging features designed specifically for remote device management. In addition to pub/sub, SMQ also supports one-to-one messaging. Each message includes a virtualized sender's address, making it possible for the message recipient to send a response message to the sender. Why this is needed for device management solutions becomes clear by studying the following figure, which uses one-to-one messaging between the device management applications and the devices.
The above figure also illustrates how a response message can be sent back to the management application by using the message's included "sender's address". The above figure in effect illustrates how an RPC style message may be constructed.
The above figure illustrates logic that is very difficult to implement in MQTT since the protocol has no way of sending a message to a specific recipient or to send a response back to the sender. In other words, MQTT cannot easily facilitate controlling each light bulb separately when there is an unknown number of devices (light bulbs in the above figure) that may connect. As an exercise, try to replicate the functionality in our SMQ LED Example using MQTT. You will find out that it is not so easy.
Furthermore, SMQ has many additional benefits over MQTT such as providing a complete development environment integrated with the broker. The broker lets you easily extend its functionality by using your own custom code. See our IoT tutorials for more information.
A cool feature with the SMQ broker is that your custom server side IoT application can create a lightweight broker instance per registered user, thus creating a physical message barrier separating each user no matter how many devices a user is in control of.
The SMQ broker is an integral part of the Mako Server and enables easy integration with other (IoT) protocols, including REST, WebSockets, MQTT, modbus, etc..
Security is paramount in any modern IoT solution, and SMQ, built from the ground up with security in mind, provides strong authentication and message authorization. SMQ is also designed to be invisible to port scanners.
Installing the SMQ broker on your own computer instead of on an online server is a great way to get started with using SMQ for learning purposes.
SMQ together with the Mako Server's integrated industrial protocols provide a solid foundation for anyone designing on-premises IoT solutions. See the tutorial Designing an On-Premises IoT Solution for details.
The SMQ broker is pre-integrated in the Mako Server. All you need to do is to activate it programmatically. The easiest way to do this is to use one of our ready to use examples such as the SMQ LED broker example bundled with the tutorials. Simply download the Mako Server for your platform and run the included tutorials script.
You may alternatively use the VPS broker installation script on your own computer if you are using Linux x86 or Windows 10.
The installation script is designed for Linux, but the installation script also works on Windows 10 if you install the Linux sub system. If you are using Windows, open Microsoft Store and search for "debian". Install the Debian Windows Subsystem for Linux and open a bash shell.
The following video shows how to use the installation script on the Windows Subsystem for Linux. You would use the same installation on a standard Linux distribution.
The following commands install the server and IoT solution on your local computer, but note that you must run the command "sudo bash" prior to pasting in the installation commands. After running the command "sudo bash", paste in the following in the bash shell:
Note: when the installation script runs, make sure to select 'N' for No when it asks to install the Let's Encrypt plugin. The plugin will not work on your local computer as it is configured for online use.
You may install the Mako Server if you have another server using the HTTP port 80. You may also ignore warnings printed by the installation script if you have another server running. The server will listen on port 9357 if you have another server using port 80. Enter the URL http://localhost:9357 in the browser if the Mako Server is unable to open port 80.
In the above video, we also install git, make, and gcc. We use these commands for downloading and compiling the SMQ C client. The following commands download and compile SMQ:
The installation script installs the Mako Server as a daemon. The Mako Server starts automatically when booting the computer and when using a standard Linux distribution. However, the Windows Subsystem for Linux is inactive until you start it, and the subsystem seems to ignore Linux boot scripts. You must therefore manually start the Mako Server from Bash as follows if you restart your Windows computer:
You may completely remove all traces of the server and example as follows: