 (def ^:dynamic *eval-js* js/eval)
 
 (let [ua-product-fn
+      ;; TODO make sure this works on other platforms
       #(cond
          (not (nil? goog/nodeGlobalRequire)) :chrome
          product/SAFARI    :safari

(defn exponential-backoff [attempt]
  (* 1000 (min (js/Math.pow 2 attempt) 20)))

(defn ws-connect [& [websocket-url']]
  ;; TODO take care of forwarding print output to the connection
  (let [websocket (goog.net.WebSocket.)
        url (str (make-url websocket-url'))]
    (patch-goog-base)

(defn ^:export session-name [] (get-state ::session-name))
(defn ^:export session-id [] (get-state ::session-id))

(defn response-for [{:keys [uuid]} response-body]
  (cond->
      {:session-id   (session-id)
       :session-name (session-name)
       :response response-body}
    uuid (assoc :uuid uuid)))

(defn respond-to [{:keys [websocket http-url] :as old-msg} response-body]
  (let [response (response-for old-msg response-body)]
