Last active
August 29, 2015 14:04
-
-
Save ul/c6aa280cc990acf423de to your computer and use it in GitHub Desktop.
SOwS1
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
(ns app.core | |
(:require [clojure.core.async :as async :refer [go-loop]] | |
[compojure.core :refer [routes GET POST]] | |
[compojure.route :as route] | |
[taoensso.sente :as sente] | |
;; ... | |
)) | |
;;;; ... | |
(let [{:keys [ch-recv send-fn ajax-post-fn ajax-get-or-ws-handshake-fn | |
connected-uids]} | |
(sente/make-channel-socket! {})] | |
(def ring-ajax-post ajax-post-fn) | |
(def ring-ajax-get-or-ws-handshake ajax-get-or-ws-handshake-fn) | |
(def ch-chsk ch-recv) ; ChannelSocket's receive channel | |
(def chsk-send! send-fn) ; ChannelSocket's send API fn | |
(def connected-uids connected-uids)) ; Watchable, read-only atom | |
(defn app-routes [] | |
(routes | |
(GET "/" [] index) | |
(GET "/chsk" req (ring-ajax-get-or-ws-handshake req)) | |
(POST "/chsk" req (ring-ajax-post req)) | |
(route/resources "/") | |
(route/not-found "Not Found"))) | |
;;;; ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment