diff --git a/README.md b/README.md index 54d8074..6ec38e3 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,16 @@ To disconnect from the broker: ``` For more detailed usage, see the API documentation and the example code in the `examples` directory. + +## JSON Client + +Milquetoast also provides a JSON client, which automatically parses JSON payloads from received messages and serializes JSON payloads for sent messages. + +To connect using the JSON client: + +```clojure +(def json-client (milquetoast.api/connect-json! :host "localhost" :port 1883)) +``` + +The JSON client can be used in the same way as the regular client, but note that the payload of received messages will be a map (parsed from the JSON payload), and the payload of sent messages should be a map (which will be serialized to a JSON string). +```