 
 (defn connect
   [url token]
-  (let [ws-url (get-rtm-ws-url url token)
-        conn (get-rtm-ws-connection ws-url)]
-    conn))
+  (-> (get-rtm-ws-url url token)
+       get-rtm-ws-connection))
+
+(defn- reset-conn
+  [options]
+  (reset! rtm-conn (connect (:url options) (:token options))))
 
 (defn subscribe
   [type func]

            [aleph.http :as http]
            [cheshire.core :as json]
            [manifold.stream :as s]
            [manifold.bus :as bus]))

(def event-bus (bus/event-bus))

(defn- get-connection-map
  [url token]


(defn start
  [options]
  (let [conn (connect (:url options) (:token options))
        _ (reset! rtm-conn conn)]
    (t/every conn-reset-delay #(reset-conn options))
    (future (s/consume publish-events (->> @rtm-conn (s/buffer 100))))
    @rtm-conn))
