Created
April 17, 2015 02:51
-
-
Save anonymous/d31ee72648f40e7ddf0c to your computer and use it in GitHub Desktop.
HttpKit websocket handler
This file contains 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
(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