    generated by executing the action-fn have completed. Returns result
    of action-fn."
   [action-fn handler-fn]
-  (let [id (next-id ::server-sync-id)
+  (let [id  (next-id ::server-sync-id)
         key (uuid)]
     (on-event "/synced"
               (fn [msg] (when (= id (first (:args msg)))

  "Blocks current thread until all osc messages in action-fn have
  completed. Returns result of action-fn."
  [action-fn]
  (let [id (next-id ::server-sync-id)
        prom (promise)
        key (uuid)]
    (on-event "/synced"
              (fn [msg] (when (= id (first (:args msg)))
                         (do

      res)))

(defn server-sync
  "Send a sync message to the server with the specified id. Server will
  reply with a synced message when all incoming messages up to the sync
  message have been handled. See with-server-sync and on-server-sync for
  more typical usage."
  [id]
  (server-snd "/sync" id))

(defn with-server-self-sync
  "Blocks the current thread until the action-fn explicitly sends a
  server sync.  The action-fn is assumed to have one argument which will
  be the unique sync id.  This is useful when the action-fn is itself
  asynchronous yet you wish to synchronise with its completion. The
  action-fn can sync using the fn server-sync.  Returns the result of
  action-fn."
  [action-fn]
  (let [id   (next-id ::server-sync-id)
        prom (promise)
        key  (uuid)]
    (oneshot-event "/synced"
                   (fn [msg] (when (= id (first (:args msg)))
                              (deliver prom true)))
