Skip to content

Instantly share code, notes, and snippets.

@jasonjckn
Created May 20, 2011 17:46
Show Gist options
  • Select an option

  • Save jasonjckn/983402 to your computer and use it in GitHub Desktop.

Select an option

Save jasonjckn/983402 to your computer and use it in GitHub Desktop.
(defn handler [chi cho]
(let [parse (fn-match ([["GET" ?gid ?uid]]
(if-let [v ((data gid) uid)]
(str v)
(str "ERROR_" gid "_" uid)))
([["STOP_SESSION"]] (close chi))
([["STOP"]] (System/exit 0)))]
#_ (receive-all chi #(enqueue cho (str "You said: " % "\r\n")))
(siphon (map* #(parse (re-seq #"\S+" %)) chi) cho)))
(defn shandler [ch _] (handler ch ch))
#_ (do
(def chi (channel "GET 1 1"))
(def cho (channel))
(handler chi cho)
cho )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment