 
 (defonce room-id (.getAttribute (. js/document (getElementById "roomid")) "data"))
 (defonce socket (js/io))
-(defonce current-sound-id "current-song")
 (defonce default-upload-slots 4)
 (defonce default-download-slots 4)
 (defonce app-state (atom {:signed-in? false

    (set! (.-onloadend reader)
      (fn []
        (swap! app-state assoc :current-sound
          (.createSound js/soundManager #js {:id current-sound-id
                                             :type "audio/mpeg"
                                             :url (.-result reader)
                                             :autoLoad true}))
        (.play (:current-sound @app-state)
               #js {:whileplaying while-playing
                    :onfinish on-finish
                    :onplay #(.setPosition js/soundManager current-sound-id
                                                           position)})))))

(.on socket "sign-in-success"
  (fn []


(.on socket "pause"
  (fn [position]
    (.pause (:current-sound @app-state))
    (.setPosition (:current-sound @app-state) position)))

(.on socket "resume"
  (fn []
    (.resume (:current-sound @app-state))))

(.on socket "position-change"
  (fn [position]
    (letfn [(set-pos [position]
              (.setPosition (:current-sound @app-state) position))]
      (println "Received pos: " position)
      (if (= 0 (.-playState (:current-sound @app-state)))
        (.play (:current-sound @app-state)
