Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nakkaya/ferret-mosquitto
https://github.com/nakkaya/ferret-mosquitto
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/nakkaya/ferret-mosquitto
- Owner: nakkaya
- Created: 2018-06-29T11:04:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-03T12:53:25.000Z (about 6 years ago)
- Last Synced: 2024-10-13T08:13:23.788Z (3 months ago)
- Language: C++
- Size: 1.95 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ferret-mosquitto
===============Wrapper for Mosquitto. Mosquitto is an open source message broker that implements
the MQTT (MQ Telemetry Transport).#### Dependencies
- Mosquitto
- On Mac OS X - `brew install mosquitto`
#### Usage
(require '[ferret-mosquitto.core :as mqtt])
(def broker (mqtt/connect "localhost" 1883))
(while (not (mqtt/connected? broker))
(sleep 100))(println "[+] Connected")
(println "[+] Subscribe " (mqtt/subscribe broker "sensors/temp"))
(mqtt/subscribe-callback
broker
(fn [topic payload]
(println "[+] Receive" topic payload)))(forever
(println "[+] Publish" (mqtt/publish broker "sensors/temp" "32.5"))
(sleep 1000))Setup `CXXFLAGS`
export CXXFLAGS="-lmosquitto -lmosquittopp"
Compile,
ferret -i program.clj -c
#### Misc
Start the broker,
mosquitto
Start the command line subscriber,
mosquitto_sub -v -t 'test/topic'
Publish test message with the command line publisher,
mosquitto_pub -t 'test/topic' -m 'helloWorld'