                 (flush-queue))
               (swap! sent-messages dissoc id)))
     (log "unrecognized message" data)))
+
+(defn join [room]
+  (send @socket "join" {:room room}))
+
+(defn leave [room]
+  (send @socket "leave" {:room room}))
+
+(defn broadcast [room msg]
+  (send @socket "broadcast" {:room room :message msg}))
+
+;;
+
+(defn main []
+  (init)
+  (join "test")
+  (broadcast "test" "hello!")
+
+
+
+  (om/root
+    (fn [app owner]
+      (reify
+        om/IRender
+        (render [_]
+          (dom/h1 nil (str "nuf " (:text app))))))
+    app-state
+    {:target (. js/document (getElementById "app"))}))

                :timestamp (.getTime (js/Date.))}]
    (if @connected?
      (do
        (swap! sent-messages assoc (:id params) params)
        (.send socket (stringify params)))
      (swap! queue conj params))))

(defn flush-queue []
  (log "flushing queue"))

(defn on-message [data]
  (condp = (.-action data)

  (.apply (.-log js/console) js/console (clj->js args)))

(defn stringify [msg] (.stringify js/JSON (clj->js msg)))

(defn s4 []
  (let [r (+ 1 (Math/random))
