first commit
This commit is contained in:
11
examples/01_publish.jl
Normal file
11
examples/01_publish.jl
Normal file
@@ -0,0 +1,11 @@
|
||||
using Mosquitto, Dates
|
||||
|
||||
# connect to a broker, also start loop if Threads.nthreads() > 1
|
||||
client = Client("test.mosquitto.org")
|
||||
|
||||
topic = "test/julia"
|
||||
message = "Hello World from Julia, send on $(now(UTC)) using the Mosquitto wrapper https://github.com/denglerchr/Mosquitto.jl"
|
||||
publish(client, topic, message; retain = true)
|
||||
!client.status.loop_status && loop(client; ntimes = 2)
|
||||
|
||||
disconnect(client)
|
||||
Reference in New Issue
Block a user