   (def connected-uids                connected-uids) ; Watchable, read-only atom
   )
 
-(defn event-msg-handler* [{:as ev-msg :keys [id ?data event ring-req]}]
-  (do
-    ;(logf (str "Event: " event))
-    (println (str "Id: " (:uid (:session ring-req))))
-    ;(println (str "Request : " ring-req))
-    ;(message-dispatch id ?data (:uid (:session ring-req)))
-    (>!! message-chan {:topic id :payload ?data :sender (:uid (:session ring-req))})))
+(defn event-msg-handler* [messages-receive-chan {:as ev-msg :keys [id ?data event ring-req]}]
+  (>!! messages-receive-chan {:topic id :payload ?data :sender (:uid (:session ring-req))}))
 
 (defonce router_ (atom nil))
 
 (defn stop-router! []
   (when-let [stop-f @router_] (stop-f)))
 
-(defn start-router! []
+(defn start-router! [messages-receive-chan]
   (stop-router!)
-  (reset! router_ (sente/start-chsk-router! ch-chsk event-msg-handler*)))
+  (reset! router_ (sente/start-chsk-router! ch-chsk (partial event-msg-handler* messages-receive-chan))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Http routing

    (stop-f :timeout 100)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Application

(defn stop! []
  (do
    (stop-http-server!)
    (stop-router!)))

(defn start! []
  (do
    (start-http-server!)
    (start-router!)))

(defn -main
  [& args]

(defn import-file [{:keys [content]}]
  (imp/dance-perfect-xml->data (imp/read-xml-string content)))

(def message-log (atom []))
(def message-send-log (atom []))

(defn message-dispatch [{:keys [topic payload sender]} out-chan]
  (match [topic payload]
