 (ns chatapp.core
   (:require [reagent.core :as r]))
-
-(defn- element [name]
-  (.getElementById js/document name))
 
 (def app-state (r/atom {:messages [{:style "init" :message "initial message"}]}))
 


    (reset! socket websocket)))

(defn sonclick [event]
  (let [input (element "input")
        text  (.-value input)]
    (.send @socket text)
    (add-message! "sent" (str ">>> " text))))

(defn conclick [event]
  (.close @socket 1000 "Close button clicked"))

     (message m))])

(defn demo []
  (let [val (r/atom "")]
    (fn []
      [:div
       [:input {:type        "text"
                :value       @val
                :placeholder "Enter text to reverse!"
                :on-change   #(reset! val (-> % .-target .-value))}]
       [:button {:type     "button"
                 :on-click oonclick}
        "Open"]
       [:button {:type     "button"
                 :on-click (partial sonclick @val)}
        "Send"]
       [:button {:type "button" :on-click conclick} "Close"]
       [message-list]])))

(defn start []
  (r/render-component
