Skip to content

Instantly share code, notes, and snippets.

@ul
Last active August 29, 2015 14:04
Show Gist options
  • Save ul/2064977d1a64fdefb398 to your computer and use it in GitHub Desktop.
Save ul/2064977d1a64fdefb398 to your computer and use it in GitHub Desktop.
SOwS2
(ns app.core
(:require-macros [cljs.core.async.macros :refer [go-loop]]
[cljs.core.match.macros :refer [match]])
(:require [clojure.data :refer [diff]]
[cljs.core.async :as async :refer [<!]]
[cljs.core.match]
[om.core :as om :include-macros true]
[taoensso.sente :as sente :refer (cb-success?)]))
(def app-state (atom {
;; Initial application state
}))
(defn app [app owner]
;; Top-level component
)
(let [{:keys [chsk ch-recv send-fn]}
(sente/make-channel-socket! "/chsk" ; Note the same path as before
{:type :auto ; e/o #{:auto :ajax :ws}
})]
(def chsk chsk)
(def ch-chsk ch-recv) ; ChannelSocket's receive channel
(def chsk-send! send-fn)) ; ChannelSocket's send API fn
(om/root app app-state {:target (js/document.getElementById "app")}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment