Skip to main content
39 votes
Accepted

When and why to use MQTT protocol?

MQTT is a "messenger" between devices: your device measures at time T a temperature of X degrees it connects (itself or via the zwave hub) to the MQTT broker it create a message with the topic /...
Goufalite's user avatar
  • 3,766
28 votes
Accepted

What is the difference between MQTT and Web Sockets, and when should I use them?

The question setting here is little bit misleading, because actually these protocols cannot at all be compared together. They are like TCP and IP, layers above each other. [1] Websockets is a low ...
mico's user avatar
  • 4,331
23 votes

When and why to use MQTT protocol?

MQ Telemetry Transport Protocol known as MQTT is designed for devices which run on low power and low bandwidth. It is a lightweight publish/subscribe messaging protocol which means any other device ...
bravokeyl's user avatar
  • 1,540
20 votes
Accepted

Can an MQTT client subscribe to a topic created by itself?

Yes, it is possible to subscribe to a topic that is created by itself. An MQTT client can be both a publisher & subscriber at the same time. In MQTT terms, a client includes both subscribers and ...
bravokeyl's user avatar
  • 1,540
16 votes

Is MQTT protocol appropriate for transmitting sensor readings over BLE?

MQTT has to run over TCP/IP (I can't remember if it's actually in the spec or if just enough assumptions are made to make it so) but its sister protocol MQTT-SN can be run over nearly any protocol ...
hardillb's user avatar
  • 12.6k
15 votes
Accepted

Can Mosquitto support multiple brokers?

Yes, Mosquitto does support multiple brokers. Mosquitto uses MQTT Bridges to connect multiple brokers thus routing messages between these mosquitto brokers. This way a bridge between your primary ...
Ghanima's user avatar
  • 2,539
13 votes
Accepted

What simple security tests can I perform on my MQTT network?

Some ideas - I've not covered all combinations of with/without username/TLS, hopefully you can see where they are missing. Can a client connect anonymously, no TLS? mosquitto_sub -t test/topic -h &...
ralight's user avatar
  • 880
13 votes

What is the difference between MQTT and Web Sockets, and when should I use them?

They're comparable in that both allow you to have full-duplex communication such that the server can immediately pass data to the client, without the client polling for it (as might be with HTTP). ...
TheMagicCow's user avatar
13 votes
Accepted

Would RPI 3 serve as IoT server with MQTT?

A Raspberry Pi 3 is a pretty serious bit of kit when you think about it Quad core Arm Cortex 1gb of RAM a onboard GPU That is a huge amount of memory, easily more than enough to run a MQTT broker ...
hardillb's user avatar
  • 12.6k
12 votes
Accepted

Don’t subscribe to # - so how to dump all messages to database with Mosquitto?

a similar system (extension/plugin) for the mosquitto broker As far as I know there is no plugin/extension for mosquitto broker ( at least no opensource one ) another recommended method that works ...
bravokeyl's user avatar
  • 1,540
12 votes

When and why to use MQTT protocol?

MQTT (Message Queue Telemetry Transport) seems to be well suited for the proposed application. It is lightweight both with respect to bandwidth (smallest packet size with a header of just 2 bytes) ...
Ghanima's user avatar
  • 2,539
12 votes
Accepted

How can I implement MQTT on an STM32F030K6T6?

Is it possible to implement MQTT on this device? Any device that has TCP/IP layer can implement MQTT. What requirements should a microcontroller match to be able to use/run MQTT? You need to ask ...
bravokeyl's user avatar
  • 1,540
12 votes

Are there any devices with open-source protocols over Wi-Fi?

The IKEA Trådfri lighting system is all CoAP based, you can find my write up on the protocol here Belkin WeMo devices are all uPnP and SOAP controlled as well so another open/self describing protocol
hardillb's user avatar
  • 12.6k
11 votes

How can I implement MQTT on an STM32F030K6T6?

The mbed mmqt library doesn't seem to document any memory requirements as likely to be limiting, and can reasonably be assumed to be targetted at this sort of small-footprint device as an endpoint. ...
Sean Houlihane's user avatar
11 votes
Accepted

Confusion about client-server connection establishment in MQTT

Does this mean that if a Client subscribes, then it remains connected to the server while the subscription is valid even though there are no data flow in most of the time? Yes, once the connection is ...
jpwsutton's user avatar
  • 126
11 votes

Don’t subscribe to # - so how to dump all messages to database with Mosquitto?

This discussion on the openHAB mailing list seems to suggest there's no issue with using # as a subscription to receive all messages: Whilst troubleshooting MQTT devices, it occurred to me ...
Aurora0001's user avatar
  • 18.5k
11 votes
Accepted

How can I interface a LoraWan network with MQTT?

Imagine your network as a Venn diagram where one set is LoraWan and the other is MQTT. Elements in the sets should know only about their set(s). So nodes using LoraWan (are in the LoraWan set) do ...
Bence Kaulics's user avatar
11 votes

Is MQTT protocol appropriate for transmitting sensor readings over BLE?

Arguably, you'd be better off doing a simple mapping of the data from BLE paradigms to MQTT, rather than trying to literally send MQTT over BLE. BLE generally exchanges data in the form of ...
Chris Stratton's user avatar
10 votes
Accepted

mosquitto_sub "connection refused" on Arch Linux

Turns out there is no broker running on the Arch system whereas installing mosquitto on Raspbian automatically starts it. Simply enable and start the broker. Start the systemd service. systemctl ...
Ghanima's user avatar
  • 2,539
10 votes

Can Mosquitto support multiple brokers?

In .NET the implementation allows to connect one client to one broker, so I'd say why not... MqttClient mqtt; string broker = ini.getData("MQTT", "hostname"); mqtt = new MqttClient(broker); mqtt....
Goufalite's user avatar
  • 3,766
10 votes
Accepted

What happens when there is not any subscriber to a topic in MQTT?

As you say, it depends on the server implementation, especially the QoS of the transmitted message if it is "at least once". IMHO MQTT is a broadcasting system, not a end-to-end protocol between two ...
Goufalite's user avatar
  • 3,766
10 votes

Don’t subscribe to # - so how to dump all messages to database with Mosquitto?

I think it is important to consider that there are many different use cases for MQTT brokers, as with any piece of software. Handling chat messages for a billion users (many users, relatively low ...
ralight's user avatar
  • 880
10 votes
Accepted

How to start Mosquitto broker service on Windows 7 from command prompt?

I finally succeeded in finding the correct command on this site. It is: net start mosquitto It can be run from any directory. If you receive the following error: D:\..\MQTT\mosquitto>net start ...
Bence Kaulics's user avatar
10 votes
Accepted

What happens if Mosquitto runs out of memory to store QoS 1/2 messages?

Messages are persisted to disk not just held in memory. Look at the autosave_interval and autosave_on_change options for when the messages get written to disk. Source
hardillb's user avatar
  • 12.6k
10 votes

Are there MQTT brokers that persist QoS 1/2 messages to disk?

I think Mosquitto saves the in-memory messages to disk. persistence [ true | false ] If true, connection, subscription and message data will be written to the disk in mosquitto.db at the ...
Ross's user avatar
  • 200
10 votes
Accepted

Should I use special characters in MQTT topics?

Goufalite is entirely correct about this problem: it's not a technical issue at all, just a naming problem, so a lot of the advice is very opinionated based on the author's idea of what names are best....
Aurora0001's user avatar
  • 18.5k
10 votes

Is it a bad practice to keep certificates on external memory?

A little bit of context Since you're using MQTT with AWS IoT, you're expected to use X.509 certificates for authentication and security. Amazon have a little bit of guidance about how you should ...
Aurora0001's user avatar
  • 18.5k
10 votes
Accepted

How to enable WebSockets on Mosquitto running on Windows?

A few things: The mosquittto_pub and mosquitto_sub commands do not support WebSockets at all. When you run mosquitto from the command line you have to explicitly point to the config file with the -c ...
hardillb's user avatar
  • 12.6k
10 votes

Performance of MQTT over TLS vs. MQTT

I wouldn't expect the difference to be too significant, once the connection is set up. A breakdown of the overhead that TLS produces in general can be found here. The important bits are: The ...
Aurora0001's user avatar
  • 18.5k
10 votes
Accepted

MQTT broker accessible from outside without opening port in firewall?

You basically have 3 options if you don't want to forward a port. Use a broker in the cloud so client from home always connect out to it. Use TLS and authentication so others can't eavesdrop or ...
hardillb's user avatar
  • 12.6k

Only top scored, non community-wiki answers of a minimum length are eligible