             [server.db.queries :as q]))
 
 (timbre/refer-timbre)
-(defonce state (atom { :stream :closed }))
 
 (defn capture-ws [req]
   (let [capture (-> req :resources :capture)

       current-recording (q/find-active-recording conn) ]
    (res {:msg "init"
          :data {:mode (:mode @capture-state)
                 :stream (:stream @state)
                 :patient-id 1
                 :current-recording current-recording}})))

(defn configure-ws [req]
  (let [{:keys [mode stream]} (:body req)
        caputre (-> req :resources :capture) ]
      (swap! (:state caputre) assoc :mode (keyword mode))
    (res {:msg "State Updated"})))

(defn init [req]
  (let [capture (-> req :resources :capture)
