Skip to content

Instantly share code, notes, and snippets.

Created April 17, 2015 02:51
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 anonymous/d31ee72648f40e7ddf0c to your computer and use it in GitHub Desktop.
Save anonymous/d31ee72648f40e7ddf0c to your computer and use it in GitHub Desktop.
HttpKit websocket handler
(defn handler [req]
(with-channel req channel
(if (websocket? channel)
(do
(on-close channel (fn [status]
(process/close-connection channel)))
(on-receive channel (fn [msg]
(process/data-connection channel msg)))
(when (open? channel)
(process/new-connection channel)))
(close channel))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment