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 ...
12
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 &...
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 ...
11
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
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 ...
11
votes
mosquitto_sub: command not found
The solution is to install mosquitto-clients as well.
pi@raspberrypi:/ $ apt-get install mosquitto-clients
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
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 ...
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 ...
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....
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 ...
9
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 ...
8
votes
How to enable detailed logging of Mosquitto broker on Windows 7?
This is what I do. Following script saved as timestampLog.vbs:
Dim str
Do While Not WScript.StdIn.AtEndOfStream
str = WScript.StdIn.ReadLine
WScript.StdErr.WriteLine "[" & now & "]" & ...
8
votes
Accepted
Can a Mosquitto MQTT client forcibly disconnect another?
Not directly.
You could use an authentication plugin such as mosquitto-auth-plug to dynamically add users to a banned list and then force a disconnection by connecting with a duplicate client id.
8
votes
Accepted
Mosquitto on Raspberry Pi refuses connection after changing log settings
One way to debug this would be to run mosquitto manually with the same options as your init system is using, then look at the output. For example:
mosquitto -v -c <path to config file>
Adding -...
8
votes
Accepted
Should I use Mosquitto's web sockets or connect clients directly?
The question here appears to be "should I use MQTT over TCP, or use MQTT over websockets (which also goes over TCP)?" In other words, is "encapsulating MQTT in the websockets protocol a good idea?"
...
7
votes
Should I use Mosquitto's web sockets or connect clients directly?
When you are communicating only inside your network (intranet), using pure TCP will be fine. But if you have to connect to another server, problems will arise.
Because most of the modern servers do ...
7
votes
List clients subscribed to a certain topic in Mosquitto server
No, you can no get list of which clients are subscribed to what out of mosquitto.
What is most likely here is that HASS is not subscribing rather than mosquitto not publishing to a subscribed client.
...
7
votes
Accepted
Are there standardized MQTT topics?
In general, no — there aren't any standards for topic naming beyond the MQTT specifications.
There are plenty of opinions about how you should construct your MQTT topics, and not a lot of fixed rules. ...
6
votes
Accepted
How to enable detailed logging of Mosquitto broker on Windows 7?
The answer of this question: How to enable WebSockets on Mosquitto running on Windows? actually answered this question as well.
As it turned out the Mosquitto's config file has to be added explicitly ...
6
votes
What simple security tests can I perform on my MQTT network?
Maybe stating the obvious, but I think it's important to emphasise that a beginner can't expect to build a secure network. Nothing wrong with learning though.
It looks like the primary security in ...
6
votes
Should I use Mosquitto's web sockets or connect clients directly?
tl;dr - always prefer free libraries to coding it your self (unless you have extreme requirements)
Should I use Mosquitto's web sockets or connect clients directly?
How long is a piece of string? ...
6
votes
Mosquitto on Raspberry Pi refuses connection after changing log settings
On Arch Linux (4.4.37-1-ARCH) with mosquitto 1.4.10-2 and an existing logfile/path with permissions as such I cannot reproduce this error.
/var/log/mosquitto $ ls -l
-rw-r--r-- 1 mosquitto root 7832 ...
6
votes
Mosquitto on Raspberry Pi refuses connection after changing log settings
The log directory/file should be owned by the mosquitto user or the user that you have setup in the conf file and group. I tried with two conf files one with out log_dest file /var/log/mosquitto/...
6
votes
Accepted
Traffic Shaping and MQTT
No, because there is no information about who published the message included in the message header, only the topic and any retained flags.
The bridge between the 2 brokers is exactly the same sort of ...
6
votes
Accepted
How long between PINGREQ and PINGRESP on Mosquitto broker?
It seems the "lag" observation is just a side-effect of the logging process, and not a real delay in the data flow.
Following the suggestion of @hardillb, I installed tshark on the Raspberry Pi. By ...
6
votes
Accepted
Can mosquitto publish the IP of clients?
No
MQTT is a lightweight protocol, it carries nothing in the headers except what is needed (Topic, QOS & Retained flag).
It also goes against the pub/sub philosophy that a publisher shouldn't ...
6
votes
Accepted
View the messages sent to the local Mosquitto server
To publish a message you should try like this:
mosquitto_pub -h localhost -t YourTopic -m "Your message"
Now if you want to see that message you should try like this:
mosquitto_sub -h localhost -...
5
votes
Accepted
How to modify only the Client ID in an MQTT CONNECT message?
I managed to find my mistake. Mistakenly I assumed that the Client ID is a fix field but it is only part of the Payload of the message thus a length-prefix is needed. From the specifications:
The ...
5
votes
How to enable WebSockets on Mosquitto running on Windows?
As @hardlib said, you have to compile mosquitto from sources. It took some trial and error for us to get it working on windows, so here some summary in case it helps somebody. Please don't hesitate to ...
5
votes
Accepted
Mosquitto debug level log - How to keep all entries but PINGREQ/PINGRESP
No, not without editing the code to remove the log statements from the ping handling code and recompiling the broker.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mosquitto × 73mqtt × 61
raspberry-pi × 5
security × 4
paho × 4
web-sockets × 4
microsoft-windows × 4
linux × 3
publish-subscriber × 3
esp8266 × 2
arduino × 2
esp32 × 2
aws × 2
home-assistant × 2
emq × 2
networking × 1
aws-iot × 1
communication × 1
zigbee × 1
data-transfer × 1
gsm × 1
android × 1
azure × 1
web-services × 1
node-red × 1