Skip to content

Instantly share code, notes, and snippets.

@victorb
Created April 12, 2019 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorb/88f8137ab1b87dc0500f066bcce0406b to your computer and use it in GitHub Desktop.
Save victorb/88f8137ab1b87dc0500f066bcce0406b to your computer and use it in GitHub Desktop.
(defn listen-for-changes [callback]
(let [res (clojure.java.io/input-stream (java.net.URL. url)) ]
(future
(with-open [rdr (clojure.java.io/reader res)]
(doseq [line (line-seq rdr)]
(callback (:id (json/read-json line true))))))
(fn [] (.close res))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment