Milquetoast
Milquetoast is a Clojure library for interacting with MQTT brokers. It provides a simple and intuitive API for sending and receiving messages, subscribing to topics, and managing MQTT connections.
Usage
First, connect to the MQTT broker:
(def client (milquetoast.api/connect! :host "localhost" :port 1883))
To send a message:
(milquetoast.api/send! client "test/topic" "Hello, MQTT!")
To subscribe to a topic and receive messages:
(def chan (milquetoast.api/subscribe! client "test/topic"))
You can then take messages from the channel as they arrive. Here's an example of how to listen on the channel and print the messages:
(go-loop []
(when-let [msg (<! chan)]
(println "Received message:" msg)
(recur)))
To disconnect from the broker:
(milquetoast.api/stop! client)
For more detailed usage, see the API documentation and the example code in the examples directory.
Description
Languages
Clojure
87.2%
Nix
12.8%