 
              #"^OK MPD.*"
              (do
+               (.log js/console data)
                (>! read-ch {:command :ok-mpd
                             :args []
                             :response data})

           write-ch (chan 10 (map event->command))
           read-ch (chan)
           buffer-ch (chan)
           socket-ch (socket-chan read-ch
                                  write-ch
                                  {:on-close (fn [] (close-socket socket))})]

       (go-loop []
         ;; process one command at a time
         (let [command (<! write-ch)
               block-ch (chan)]
           (.write socket command
                   (fn []
                     (go
                       (let [response (<! process-ch)
                             event (command->event command)]
                         (>! read-ch (assoc event :response response))
                         (close! block-ch)))))
           (<! block-ch)
           (recur)))

       (.on socket "data"
            (fn [data] (put! buffer-ch (str data))))

       ;; TODO: abstract this code out of connect fn
       ;;       so that it is more generic/reusable


             #"^ACK"
             (do
               (.log js/console (str "ACK: " data))
               (recur ""))

             #"^OK$"
