Skip to content

Instantly share code, notes, and snippets.

@ztellman
Forked from jasonjckn/gist:983417
Created May 20, 2011 18:01
Show Gist options
  • Save ztellman/983425 to your computer and use it in GitHub Desktop.
Save ztellman/983425 to your computer and use it in GitHub Desktop.
(defn handler [chi cho]
(let [parse (fn-match ([["GETT" ?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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment