              (let [typ (gobj/get msg "connection-type")]
                (glog/info logger (str "Connected: " typ))
                (msg-fn msg)
+               ;; after connecting setup printing redirects
+               (hook-repl-printing-output! {:http-url surl})
                (if (= typ "http-long-polling")
                  (long-poll msg-fn connect-url')
                  (poll msg-fn connect-url'))))

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

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

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

                                 (glog/error logger e))))))
      (.addEventListener goog.net.WebSocket.EventType.OPENED
                         (fn [e]
                           (hook-repl-printing-output! {:websocket websocket})
                           (js/console.log "OPENED")
                           (js/console.log e)))
      (.open url))))
