 ;; ## First up Sente, define send-tx!, and hook up message handler router
 
 (defrecord DBFn [lang params code])
-(cljs.reader/register-tag-parser! 'db/fn map->DBFn)
+;(defn tagged-fn [:datsync.server/db-fn])
+(cljs.reader/register-tag-parser! 'db/fn pr-str)
 
 (let [packer (sente-transit/get-flexi-packer :edn)
       {:keys [chsk ch-recv send-fn state]}

;; Set up push message handler

; Dispatch on event key which is 1st elem in vector
(defmulti push-msg-handler
  (fn [[id _]] id))

(defmethod event-msg-handler :chsk/recv
  [{:as ev-msg :keys [?data]}]

  [[_ tx-data]]
  (datsync/apply-remote-tx! db/conn tx-data))

(defmethod push-msg-handler :datsync.client/bootstrap
  [[_ tx-data]]
  ;; Possibly falg some state somewhere saying bootstrap has taken place?
  (println "Recieved tx")
  ;(doseq [x-form (remove :db/id tx-data)]
    ;(println "    " x-form))
  (datsync/apply-remote-tx! db/conn tx-data))

;; TODO Add any custom handlers here!



