                                                                        "$referrer" ""
                                                                        "$referring_domain" ""}
                                                          "compress" false}}))
-    (while (not @reconnect-needed) (Thread/sleep 1000))
+    (while @the-keepalive (Thread/sleep 1000))
     (try
-      (connect token functions log-events? log-function max-text-message-size)
-      (catch java.net.UnknownHostException e 
+      (connect token functions log-events? log-function max-text-message-size true)
+      (catch Exception e 
         (do
           (log-function "Caught exception: " (.getMessage e))
-          (Thread/sleep 10000)
-          (connect token functions log-events? log-function max-text-message-size))))))
+          (Thread/sleep 60000)
+          (try
+            (connect token functions log-events? log-function max-text-message-size true)
+            (catch Exception e 
+              (do
+                (log-function "Caught exception: " (.getMessage e))
+                (log-function "Abandoning!")
+                (disconnect)
+                ))))))))
+
+(defn connect-without-blocking
+  ([token functions]
+    (connect-without-blocking token functions default-log-events? default-log-function default-max-text-message-size))
+  ([token functions log-events?]
+    (connect-without-blocking token functions log-events? default-log-function default-max-text-message-size))
+  ([token functions log-events? max-text-message-size]
+    (connect-without-blocking token functions log-events? default-log-function max-text-message-size))
+  ([token functions log-events? log-function max-text-message-size]  
+    (connect-without-blocking functions log-events? log-function max-text-message-size))
+  ([token functions log-events? log-function max-text-message-size]
+    ((.start (Thread. (fn [] (connect token functions log-events? log-function max-text-message-size)))))))
 
 (defn post-message [channel-id message]
   (http/post (str "https://discordapp.com/api/channels/" channel-id "/messages")

                               (if (not (nil? type)) (doseq [afunction (get functions type (get functions "ALL_OTHER" []))]
                                                       (afunction type data)))))))
    (.start (Thread. (fn []
                       (try
                         (while @the-keepalive
                           (if (nil? @the-heartbeat-interval)
                             (Thread/sleep 100)
                             (do

                               )))
                         (catch Exception e (do
                                              (log-function "Caught exception: " (.getMessage e))
                                              (reset! the-keepalive false)
                                              ))))))
    (Thread/sleep 1000)
    (ws/send-msg @the-socket (json/write-str {:op 2, :d {"token" @the-token
