Created
August 17, 2015 04:32
-
-
Save jimrthy/27c7d139c9de9c9948d5 to your computer and use it in GitHub Desktop.
Sample of translating sente web socket upgrade request handlers into fnhouse routes
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
(defnk $chsk$GET | |
{:responses {200 {:what? s/Int}}} | |
;; Note the way to just access the full request | |
[request | |
[:resources [:web-sock-handler ch-sock]]] | |
(let [handler (:ring-ajax-get-or-ws-handshake ch-sock) | |
response (handler request)] | |
response)) | |
(defnk $chsk$POST | |
{:responses {200 {}}} | |
[request | |
[:resources [:web-sock-handler chsk]]] | |
;; Q: When is this supposed to happen? | |
(log/debug "chsk post:\n" | |
(util/pretty request)) | |
(let [handler (:ring-ajax-post chsk)] | |
(handler request))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment