             ;; [cljs.core.async :refer [<! >! chan timeout take! put!]]
             [cljs.core.async :as async :refer [chan >! <! timeout]]
             [clojure.core.async.impl.protocols :as impl]))
+
+(defn log [& args] (.log js/console (reduce str args)))
 
 ;; We break up the send channel into two, one specifically for the
 ;; application we call this the app-send-chan.  This channel is


(enable-console-print!)

(defn log [& args] (.log js/console (reduce str args)))

;; --------- REPL Testing ----------
(def url "ws://localhost:7890")
;; seems okay
;; (on-open (->AsyncWebsocket url (chan) (chan) (chan) nil))

;; fails
;; (new-websocket! (->AsyncWebsocket url (chan) (chan) (chan) nil))

;; main test:
(def ws1 (async-websocket url))
;; (go (>! ws1 "Hello")
;;     (.log js/console "Answer" (<! ws1)))

;; This is why we have to break up the send channel, so the app can
;; have a reliably there channel to work with.

(declare ws-state log new-websocket! monitor-send-msg-queue! dummy-on-msg)

(defrecord AsyncWebsocket [ws-url app-send-chan app-recv-chan ws-only-send-chan websocket]
  impl/ReadPort
