Add labs
This commit is contained in:
7
01-basics/lab06/docker-compose.yml
Normal file
7
01-basics/lab06/docker-compose.yml
Normal file
@ -0,0 +1,7 @@
|
||||
services:
|
||||
mosquitto:
|
||||
image: eclipse-mosquitto
|
||||
ports:
|
||||
- "1883:1883"
|
||||
volumes:
|
||||
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
||||
34
01-basics/lab06/lab.txt
Normal file
34
01-basics/lab06/lab.txt
Normal file
@ -0,0 +1,34 @@
|
||||
= Publish
|
||||
|
||||
Nutzen Sie mosquitto_pub als Client und lassen sich zunächst die Hilfe ausgeben.
|
||||
|
||||
Sie können mosquitto_pub mit Docker ausführen:
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto mosquitto_pub --help
|
||||
|
||||
Publizieren Sie auf das Topic `training`.
|
||||
Verwenden Sie anschließend `mosquitto_sub` mit dem Topic, erhalten Sie die Nachricht?
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto mosquitto_pub --topic training --message "hello trion"
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto mosquitto_sub --topic 'training' --debug
|
||||
|
||||
|
||||
Starten Sie zuerst die Subscription und publizieren Sie danach in einem separaten Terminalfenster.
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto mosquitto_sub --topic 'training' --debug
|
||||
|
||||
$ docker run --rm -it --net host eclipse-mosquitto mosquitto_pub --topic training --message "hello trion"
|
||||
|
||||
|
||||
Nutzen Sie mehrere Subscriber parallel, z.B. auch cURL
|
||||
|
||||
$ curl --output - --trace - mqtt://localhost/training
|
||||
|
||||
|
||||
|
||||
= Referenzen
|
||||
|
||||
mosquitto_sub https://mosquitto.org/man/mosquitto_sub-1.html
|
||||
|
||||
mosquitto_pub https://mosquitto.org/man/mosquitto_pub-1.html
|
||||
4
01-basics/lab06/mosquitto.conf
Normal file
4
01-basics/lab06/mosquitto.conf
Normal file
@ -0,0 +1,4 @@
|
||||
listener 1883
|
||||
allow_anonymous true
|
||||
|
||||
# sys_interval 3
|
||||
Reference in New Issue
Block a user