               (print-to-stream stream args)))
     (wait-for-connection repl-env)
     (let [ev-connections (eval-connections repl-env)
-          result (let [v (deref (send-for-eval ev-connections js)
+          result (let [v (deref (send-for-eval repl-env ev-connections js)
                                 (or repl-timeout 8000)
                                 timeout-val)]
-                   (if (= timeout-val v)
-                     {:status :exception
-                      :value "Eval timed out!"
-                      :stacktrace "No stacktrace available."}
-                     v))]
+                   (cond (= timeout-val v)
+                     (do
+                       (when @focus-session-name
+                         (reset! focus-session-name nil))
+                       {:status :exception
+                        :value "Eval timed out!"
+                        :stacktrace "No stacktrace available."})
+                     (::no-connection-made (meta v))
+                     (do
+                       (when @focus-session-name
+                         (reset! focus-session-name nil))
+                       v)
+                     :else v))]
       (when-let [out (:out result)]
         (when (not (string/blank? out))
           (repl-env-print repl-env :out [(string/trim-newline out)])))

      (Thread/sleep 500)
      (recur))))

(defn send-for-eval [connections js]
  (send-for-response connections {:op :eval :code js}))

(defn eval-connections [{:keys [focus-session-name
                                broadcast] :as repl-env}]
  (let [connections (connections-available repl-env)
          ;; session focus
        connections (if-let [focus-conn


  scratch

  (do
    (cljs.repl/-tear-down re)
    (def re (repl-env* {:output-to "dev-resources/public/out/main.js"}))
    (cljs.repl/-setup re {}))

  (connections-available re)
  (open-connections)
  (evaluate (assoc re :broadcast true)
            "88")

  (evaluate re "setTimeout(function() {cljs.core.prn(\"hey hey\")}, 1000);")

