Skip to main content

Mosquitto

Mosquitto

The Mosquitto project is a proposed open source project under the Technology Container Project.

This proposal is in the Project Proposal Phase (as defined in the Eclipse Development Process) and is written to declare its intent and scope. We solicit additional participation and input from the Eclipse community. Please send all feedback to the Eclipse Proposals Forum.

Background

MQTT is a protocol created in the late 1990s by Andy Stanford-Clark of IBM and Arlen Nipper, then of Arcom Control Systems. It was designed for machine-to-machine (M2M) communication, and runs over TCP/IP. The current version of MQTT is 3.1; the specification is for which is held on IBM developerWorks. Its primary goals are:

  1. to avoid polling of sensors, allowing data to be sent to interested parties the moment it is ready
  2. lightweight, so that it can be used on very low bandwidth connections
MQTT is currently undergoing standardization at OASIS.

MQTT-SN (currently being renamed from MQTT-S) is a protocol derived from MQTT, designed for connectionless underlying network transports such as UDP. The definition of the MQTT-SN protocol is held at MQTT.org. It is less mature than MQTT, the specification being published in 2008, by Andy Stanford-Clark and Hong Linh Truong, both of IBM.

Both MQTT and MQTT-SN are client-server protocols, for which a server is needed to distribute messages between the client applications. They also both use the publish-subscribe paradigm, rather than queueing: a receiving application subscribes to topics of interest, and the sending application publishes messages to topics. The publisher is disassociated from any subscribers - it has no knowledge of whether any application is receiving its messages. MQTT and MQTT-SN are undergoing an increase in interest as a consequence of the activity and publicity around the Internet of Things, to which they are suited.

After several IBM servers were produced during the 2000s, Really Small Message Broker (RSMB) was released onto IBM alphaWorks in 2008. It's aim was to be a minimalist MQTT server, and according to the usual alphaWorks practices, was closed source and released under an evaluation-only license. During the following two years, it gained a small but enthusiastic following. In 2010, Roger Light learned about MQTT and RSMB from an Andy Stanford-Clark presentation. He created Mosquitto to be an open source alternative to RSMB.

Since then Mosquitto has gained an enthusiastic following of its own, and has grown to include functions not available in RSMB. It has been included in several Linux distributions. RSMB has had MQTT-SN capabilities added but not released outside of IBM. Now we have the chance to bring Mosquitto and RSMB back together as one Eclipse project, taking advantage of the collaboration of the authors of both previous projects.

Scope

The Mosquitto project provides a small server implementation of the MQTT and MQTT-SN protocols. Small means that:

  1. only necessary function is included (conditional compilation can be used to be able to omit unneeded function for a particular application),
  2. that function is coded as efficiently as possible,
  3. the externals are as simple as possible for the function provided.

The server has the following features, which are not described in the MQTT specification:

  1. An MQTT bridge, to allow Mosquitto to connect to other MQTT servers.
  2. The ability to secure communications using SSL/TLS.
  3. User authorization - the ability to restrict user access to MQTT topics.

Mosquitto is able to translate and transfer messages between MQTT and MQTT-SN, so that it can act as a gateway between devices which communicate with either protocol.

Mosquitto keeps up to date with any MQTT or MQTT-SN specification changes, for instance the outcome of the OASIS MQTT specification standardization. Mosquitto adheres to the protocol specifications and standards as closely as possible, so it may be used in conformance testing. Any included non-standard behaviour is optional.

Description

Mosquitto provides a lightweight server implementation of the MQTT and MQTT-SN protocols, written in C. The reason for writing it in C is to enable the server to run on machines which do not even have capacity for running a JVM. Sensors and actuators, which are often the sources and destinations of MQTT and MQTT-SN messages, can be very small and lacking in power. This also applies to the embedded machines to which they are connected, which is where Mosquitto could be run.

Typically, the current implementation of Roger Light's Mosquitto has an executable in the order of 120kB that consumes around 3MB RAM with 1000 clients connected. There have been reports of successful tests with 100,000 connected clients at modest message rates.

As well as accepting connections from MQTT client applications, Mosquitto has a bridge which allows it to connect to other MQTT servers, including other Mosquitto instances. This allows networks of MQTT servers to be constructed, passing MQTT messages from any location in the network to any other, depending on the configuration of the bridges.

Why Eclipse?

Over the past few years, Eclipse has become an obvious destination for projects involved in M2M through the creation of the M2M Industry Working Group and the number of related projects being created.

Roger hopes that bringing Mosquitto to Eclipse will increase its exposure for both users and possible contributors to the project. By contributing RSMB to Eclipse, IBM hopes to strengthen the MQTT community within Eclipse, and enable the functions provided by RSMB to be enjoyed by a wider audience.

The proposed Mosquitto project is complementary with existing Eclipse projects that make use of MQTT, such as Paho and Koneki. Paho provides MQTT client libraries in various languages. The Mosquitto project is complementary to Paho by providing the required server which allows client devices and applications to communicate with each other. The combination of Paho and Mosquitto will allow complete MQTT and MQTT-SN based M2M solutions to be built.

The existing open-source Mosquitto project is already linked with Eclipse as it provides the MQTT sandbox server available at m2m.eclipse.org.

Initial Contributions

The initial contributions will be made from the two projects previously mentioned, which have a lot in common, but different implementations:

  1. Mosquitto, an open source project created by Roger Light
  2. Really Small Message Broker (RSMB),, a closed source project owned by IBM, created by Ian Craggs.

They are similar because Mosquitto was originally written as an open-source replacement for RSMB. The incorporation of both codebases into the same Eclipse project, gives the opportunity of taking the best of both.

Mosquitto

The Mosquitto code base is currently held at Bitbucket in a Mercurial repository (bitbucket.org/oojah/mosquitto). This includes the broker/server itself, as well as MQTT client libraries in C, C++, Python and JavaScript. The JavaScript client is considered deprecated because of the Paho JavaScript client and the Python client has already been submitted to Paho.

There is a reasonable community starting to exist around Mosquitto. The bug tracker lists 133 bugs submitted, the mosquitto-users mailing list has 79 members and stackoverflow has 44 questions that mention mosquitto. The code is majority owned by the contributor, but there have been a few contributions from other parties. The external dependencies of Mosquitto are:

  • openssl (OpenSSL and SSLeay licenses: both BSD-style)
  • uthash (BSD revised license)
  • libwrap/tcp-wrappers (license)

Really Small Message Broker

The second contribution is the Really Small Message Broker server and MQTT-SN client code, all of which is copyright IBM in its entirety - there is no third party licensed code. It will be made available under the EPL and EDL.

Legal Issues

As noted above, there have been a few code contributions from other parties to the current Mosquitto codebase.

It is intended that the project be dual licensed under the EPL and EDL. The inclusion of EDL is primarily so that the project can be included in Linux distributions, which use the GPL, which Roger Light's existing Mosquitto project is already.

Committers

The following individuals are proposed as initial committers to the project:

Roger Light, University of Nottingham
Roger is the creator and main contributor of Mosquitto. He will be the project leader.
Ian Craggs, IBM
Ian is the creator and main author of Really Small Message Broker.

We welcome additional committers and contributions.

Mentors

The following Architecture Council members will mentor this project:

  • Doug Schaefer
  • Achim Lörke

Interested Parties

The following individuals, organisations, companies and projects have expressed interest in this project:

  • Andy Piper, Pivtol Labs
  • Dave Locke, IBM

Project Scheduling

Changes to this Document

Date Change
22-Oct-2013 Second mentor added.

Back to the top