Linux/Mosquitto: Difference between revisions

From Wiki
mNo edit summary
Line 1: Line 1:
* usage
== Basic usage ==
** subscribe
* subscribe
<blockquote>
<blockquote>
<pre>
<pre>
Line 8: Line 8:
</pre>
</pre>
</blockquote>
</blockquote>
:* publish
* publish
<blockquote>
<blockquote>
<pre>
<pre>
Line 17: Line 17:
</blockquote>
</blockquote>


 
== User ==
* add user
<blockquote>
<blockquote>
<pre>
<pre>
Line 25: Line 24:
</blockquote>
</blockquote>


== config ==
= Config =
* get mosquitto.conf from docker container
<pre>
<pre>
docker cp mosquitto:/mosquitto/config/mosquitto.conf .
docker cp mosquitto:/mosquitto/config/mosquitto.conf .
</pre>
</pre>
 
== simple broker ==
<pre>
<pre>
allow_anonymous true
allow_anonymous true
Line 37: Line 37:
log_dest file /mosquitto/log/mosquitto.log
log_dest file /mosquitto/log/mosquitto.log
</pre>
</pre>
== bridge ==


== Links ==
== Links ==

Revision as of 20:16, 2 December 2023

Basic usage

  • subscribe
mosquitto_sub -t "test" -h servername
mosquitto_sub -t "test" -h servername -u "username" -P "password"
mosquitto_sub -t "test" -h servername -u "username" -P "password" -p 8883 --capath /etc/ssl/certs/
  • publish
mosquitto_pub -t "test" -m "test message" -h servername
mosquitto_pub -t "test" -m "test message" -h servername -u "username" -P "password"
mosquitto_pub -t "test" -m "test message" -h servername -u "username" -P "password" -p 8883 --capath /etc/ssl/certs/

User

mosquitto_passwd /etc/mosquitto/users BENUTZERNAME

Config

  • get mosquitto.conf from docker container
docker cp mosquitto:/mosquitto/config/mosquitto.conf .

simple broker

allow_anonymous true
listener 1883
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log

bridge

Links