Simple Message Queue: IoT Messaging

Remote control embedded devices directly from HTML5 in real-time, stream data to and from devices, and/or use broker/server for IoT Edge Node data acquisition.

SMQ is an easy to use IoT (M2M) publish subscribe protocol designed and optimized for embedded systems providing instantaneous Edge Node connectivity. The solution allows resource contrained real-time control, analysis, and updates.


  • End-to-End IoT Security and Military Grade Encryption
  • ANSI C Source Code; 2K non-secure, 22K secure (TLS)
  • SMQ broker supports clustering and horizontal scaling
  • Designed for Low-Cost (Resource Constrained) Edge Nodes
  • Bare Metal (Super-Loop) and RTOS Support
  • Pub/Sub, direct addressing, and RPC for IoT applications
  • No Firewall/NAT Hassle; Private IP to Private IP Communication
  • SOCKS and HTTPS proxy support (secure version)
  • Pre-Integrated Security with SharkSSL *(Optional)

Library Summary

  • SMQ Client - Thin C Source Library (2Kb)
  • SharkMQ Client - Secure C Source Library (22Kb)
  • SMQ Broker - Broker, Server, and Management Component
  • SMQ.js - JavaScript Library
  • JavaSMQ - Java and Android Library


The figure below shows an NXP CortexM3 board running the SMQ LED demo and being controlled from a tablet. The board and the tablet connect to our public broker, which is shown embedded to the right.

Secure IoT Communication

SMQ Source Code

We provide several SMQ source code implementations for various programming languages.


Technical Information

Library Summary

  1. SimpleMQ Client a C Source code library that compiles into 2KBytes on a Cortex M4 and with direct interface to sockets.
  2. SharkMQ™ a secure implementation of the SimpleMQ Client which utilizes SharkSSL™. The complete SharkSSL and SimpleMQ code combination can be as small as 21KBytes ROM with the selected cipher combination ECC and ChaCha20-Poly1305.
  3. SimpleMQ Broker management component.
  4. SimpleMQ-JS a JavaScript library that utilizes WebSockets for the Message Queue communication.

SMQ References:

Architecture Overview

Embedded Devices initiate the IoT communication with the SMQ Broker by use of a standard web URL, which is either HTTP for non secure or HTTPS for secure communication. The device to broker communication is established in a similar fashion to how WebSockets are initiated.

Once a connected session occurs, the SimpleMQ Client may then publish and subscribe to topic names. A topic name can be any string value, but is typically structured in a hierarchical fashion, which is by common comparison equivalent to that of a file system hierarchy found in a UNIX like environment.

Topic names are then translated into numbers by the server, thus enabling fast processing of messages by using lookup tables and values stored on the server. The client subscribes to a topic and the server responds with a topic ID that identifies the topic channel. Each client is also assigned a unique ID by the broker know as the ephemeral topic ID. The ephemeral topic ID is used in a unique way such as "publisher's address" by subscriber, thus enabling each subscriber the ability to send messages directly to a device by using the pehemeral topic ID. The ephemeral topic ID also enables an application to simulate a remote procedure (RPC) call.

The SMQ broker provides easy segmentation of products/customers by enabling an unlimited number of broker instances running in the server. Each Message Queue entry (URL) in the server is associated with one broker instance, thus the number of instances that can be installed in the server at any given time are only limited to any inherent memory limitations.

SMQ Architecture Diagram

Simple Message Queues

Figure 1: Four clients connected to a broker, where one device utilizes a secure TCP connection, one device utilizes a non secure TCP connection, and two browser clients utilize WebSockets in either secure or non-secure mode.


  • Enables easy IoT management of microcontroller based device solutions such as sensors and actuators.
  • The SMQ Broker may run "as is" on top of an Application Server or a derivative Web Server product.
  • Application programmers may optionally create server side applications to communicate with browsers using standard HTTP(S)
  • Real-Time Web Socket connections are accessible via the SimpleMQ-JS JavaScript library, which simplifies the interface.
  • Enables easy IoT traversal of firewalls and proxies since communication is initiated over HTTP(S)
  • Server side code can be enabled to analyze incoming requests and act on them accordingly.
  • Port requirements are minimized to standard ports 80 and 443 without need for redundant listening ports.

Device Solution

SimpleMQ Client is provided in C Source Code and is built for a direct device interaction with TCP/IP. The communication client is designed and utilized to preserve resources, which are typically vital for small constrained microcontrollers. Devices may authenticate themselves by using standard credentials such as username/password, or key values by example. The SimpleMQ client while operating in a (non-secure) mode still allows for an easy use of hash based authentication, which is useful to establish a secure encrypted password connection to prevent eavesdropping.

SharkMQ™ is simply the secure version of the SimpleMQ Client which makes use of the SharkSSL TLS stack for maintaining a trusted, secure, and encrypted communication. Designers may use certificates for both device and broker authentication, thus optionally enable mutual authentication by use of X.509 certificates.

The figure to the right shows our bare metal SharkMQ™ reference platform is a mere 38Kb ROM and 13Kb RAM. The reference platform includes application (demo) code, SharkMQ, SharkSSL, TCP/IP stack, and drivers; all in tiny 38Kb. Also the complete RAM usage for the entire system is only 13Kb. As proof, we have made the linker's map file available for download.

Complete secure IoT solution in 38Kb

Figure 2: A complete reference platform in 38K ROM and 13K RAM.

Browser Solution

The IoT Message Queue protocol for a browser is channeled over a WebSocket connection. All major browsers support WebSockets as a persistent real-time communication protocol, which in turn enables JavaScript code running in a browser to interact with a WebSocket enabled server. The browser solution consists of the SimpleMQ-JS JavaScript library that enables JavaScript applications to subscribe to and publish to topics.

Android and Java Solution

Secure SMQ IoT Demo

The Java SMQ client stack can be used on any Java powered environment such as Android. A demo showcasing how to control LEDs in a device in real-time is available and can be installed on any Android device. The native Android app provides an alternative to the browser based LED demo user interface. The Android app is available at the Android app store as the SMQ IoT LED Demo.

Broker SSL Termination

SMQ Broker enables IoT SSL termination. To illustrate by example we have an external browser using secure WebSockets sending a message to non-secure devices utilizing the SimpleMQ Client. In this example the SMQ Broker decrypts the message received from the browser and then forwards the unencrypted result to the two non-secure devices. This communication also works in reciprocal pattern where a non secure client is able to send messages to a secure client.

Simple Message Queue SSL Termination

Figure 3: SMQ Broker SSL Termination Diagram

Protocol Specification