 (defn connection-send [{:keys [send-fn] :as conn} data]
   (send-fn conn data))
 
+(defn send-for-response* [prom conn msg]
+  (let [uuid (str (java.util.UUID/randomUUID))
+        listener (fn listen [msg]
+                   (when (= uuid (:uuid msg))
+                     (when-let [result (:response msg)]
+                       (deliver prom
+                                (if (instance? clojure.lang.IMeta result)
+                                  (vary-meta result assoc ::message msg)
+                                  result)))
+                     (remove-listener listen)))]
+    (add-listener listener)
+    (try
+      (connection-send
+       conn
+       (json/write-str
+        (-> (select-keys conn [:session-id :session-name])
+            (merge msg)
+            (assoc :uuid uuid))))
+      (catch Throwable t
+        (remove-listener listener)
+        (throw t)))))
+
+(def no-connection-result
+  (vary-meta
+   {:status :exception
+    :value "Expected REPL Connections Evaporated!"
+    :stacktrace "No stacktrace available."}
+   assoc ::no-connection-made true))
+
+(defn broadcast-for-response [connections msg]
+  (let [prom (promise)
+        cnt  (->> connections
+                  (mapv #(try
+                           (send-for-response* prom % msg)
+                           true
+                           (catch Throwable t
+                             nil)))
+                  (filter some?)
+                  count)]
+    (when (zero? cnt)
+      (deliver prom no-connection-result))
+    prom))
+
 (defn send-for-response [connections msg]
-  ;; TODO remove all listeners after single response?
-  ;; or have one listener and one uuid
-  (let [prom (promise)]
-    (doseq [conn connections]
-      (let [uuid (str (java.util.UUID/randomUUID))
-            listener (fn listen [msg]
-                       (when (= uuid (:uuid msg))
-                         (when-let [result (:response msg)]
-                           (deliver prom
-                                    (if (instance? clojure.lang.IMeta result)
-                                      (vary-meta result assoc ::message msg)
-                                      result)))
-                         (remove-listener listen)))]
-        (add-listener listener)
-        (connection-send
-         conn
-         (json/write-str
-          (-> (select-keys conn [:session-id :session-name])
-              (merge msg)
-              (assoc :uuid uuid))))))
+  (let [prom (promise)
+        sent (loop [[conn & xc] connections]
+               (when conn
+                 (if-not (try
+                           (send-for-response* prom conn msg)
+                           true
+                           (catch Throwable t
+                             false))
+                   (recur xc)
+                   true)))]
+    (when-not sent
+      (deliver prom no-connection-result))
     prom))
 
 (defn http-long-polling-connect [ring-request respond raise]


(defn open-connections []
  (filter (fn [{:keys [is-open-fn] :as conn}]
            (or (nil? is-open-fn) (is-open-fn conn)))
          (vals @*connections*)))

(defn connections-available [repl-env]

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





(defn send-for-eval [{:keys [focus-session-name ;; just here for consideration
                             broadcast] :as repl-env} connections js]
  (if broadcast
    (broadcast-for-response connections {:op :eval :code js})
    (send-for-response connections {:op :eval :code js})))

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