                 :timestamp (.getTime (js/Date.))}]
     (if @connected?
       (do
+        (log "sending via socket, waiting for ACK")
         (swap! sent-messages assoc (:id params) params)
         (.send socket (stringify params)))
-      (swap! queue conj params))))
+      (do
+        (log "enqueing")
+        (swap! queue conj params)))))
 
 (defn flush-queue []
-  (log "flushing queue"))
+  (log "identified flushing queue")
+  (doseq [item @queue]
+    (log "sending" (clj->js item))
+    (.send @socket (stringify item)))
+  (reset! queue []))
 
 (defn on-message [data]
   (condp = (.-action data)

                (flush-queue))
              (swap! sent-messages dissoc id)))
    (log "unrecognized message" 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))
