 (defonce items (atom {:position 0
                       :latest []}))
 
+(defonce handlers (atom {:by-id {}}))
+
 (defonce error (atom nil))
 
 (defonce cider-handlers [#'cider.nrepl.middleware.apropos/wrap-apropos

                    from)]
    {:from (if (<= drop-n 0) (- position n) from)
     :messages (drop drop-n latest)}))

                   {:position (inc position)
                    :latest ((comp vec (partial take 500) (partial conj latest))
                             msg)}))
    (if-let [handler (-> @handlers :by-id (get (msg :id)))]
      ;; TODO (safely (handler msg)
      (handler msg))
    (catch Exception e
      (reset! error e))))

