Created
December 21, 2015 14:18
-
-
Save ekhall/1d1c17f9dbd14cf0f003 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns aurora.models.lab | |
(:require [clojure.java.jdbc :as sql] | |
[twilio.core :as twilio] | |
[clojurewerkz.machine-head.client :as mh])) | |
(defn send-mqtt [message & args] | |
(let [id (mh/generate-id) | |
conn (mh/connect mqtt-url id)] | |
(mh/subscribe conn ["gossamer"] (fn [^String topic _ ^bytes payload] | |
(println (String. payload "UTF-8")))) | |
(mh/publish conn "gossamer" message) | |
{:status 200 | |
:headers {"Content-Type" "text/plain"} | |
:body "Published Message!"})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment