Skip to content

Instantly share code, notes, and snippets.

@siscia
Created July 20, 2013 08:59
Show Gist options
  • Save siscia/6044379 to your computer and use it in GitHub Desktop.
Save siscia/6044379 to your computer and use it in GitHub Desktop.
;; I would be very surprised if it works...
(go
(loop []
(let [c (chan)
tok (do
(reify MqttCallback
(deliveryComplete [_ tok]
(when-let 1
(go (>! c :arrived))
(swap! tok->chan dissoc tok))))
(mqtt-publish client "sneezing" "[80 m/s]"))]
(swap! tok->chan assoc tok c)
(when-not (alts! c (timeout 10000))
(recur)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment