 (def socket (atom nil))
 
 (defn oonclick [event]
-  (output "click" "Button Clicked")
-
   (.preventDefault event)
 
   (let [uri       (str "ws://" (.-host js/location) "/ws")

    (reset! socket websocket)))

(defn sonclick [event]
  (let [input (.getElementById js/document "input")
        text  (.-value input)]
    (.send @socket text)
    (output "sent" (str ">>> " text))))

(ns chatapp.core)

(defn- element [name]
  (.getElementById js/document name))

(defn output [style text]
  (let [messages         (element "messages")
        current-messages (.-innerHTML messages)
        current-message  (str "<br/><span class='" style "'>" text "</span>")]
    (set! (.-innerHTML messages) (str current-messages current-message))))
