feat: Add new client functions for messaging and connection handling

This commit is contained in:
2025-06-08 09:42:51 -07:00
committed by niten
parent 9e21bc1464
commit ccc02809fa
+31 -9
View File
@@ -1,13 +1,35 @@
(ns milquetoast.client (ns milquetoast.client
(:require [milquetoast.api :as api]) (:require [milquetoast.api :as api]))
(:import [clojure.lang ExceptionInfo]))
(defn- deprecated [f] (defn send! [client topic msg & {:keys [qos retain]
(fn [& args] :or {qos 1 retain false}}]
(println (str "WARNING: The function '" (name f) "' in the 'milquetoast.client' namespace is deprecated. Please use 'milquetoast.api' instead.")) ...)
(apply f args)))
(defmacro defdeprecated [name & body] (defn get! [client topic & options]
`(def ~name (deprecated (fn ~@body)))) ...)
(println "WARNING: The 'milquetoast.client' namespace is deprecated. Please use 'milquetoast.api' instead.") (defn get-raw! [client topic & options]
...)
(defn open-channel!
[client topic & {:keys [buffer-size qos retain]
:or {buffer-size 1
qos 1
retain false}}]
...)
(defn subscribe!
[client topic & {:keys [buffer-size qos]
:or {buffer-size 1
qos 1}}]
...)
(defn connect!
[& {:keys [host port scheme verbose]
:or {verbose false
scheme :tcp}
:as opts}]
...)
(defn connect-json! [& args]
...)