               ;; Let loop die if ws-channel dies
               (go-loop
                 []
-                (when-let [message (<! write-channel)]
+                (when-let [message (<! read-from-client)]
                   (when (not (h/has-type message (:type h/socket-closed-message)))
                     (do
                       (>! formated-channel message)

  The second is a meta channel that receives a messages each
  time the channel is either disconnected or connected."
  []
  (let [read-channel  (chan)
        write-channel (chan)
        meta-channel  (chan (sliding-buffer 1))]
    (go 
      (>! meta-channel (h/attempting-connect-message address))


;; Address to host
(def address "ws://localhost:5000")
;(def address "ws://tree-mind-tone.herokuapp.com")

(defn open-connection
  "Establishes a loop that maintains a connection to a server.
