   (if (:websocket request)
     (dosync
       (ref-set chat-channel ch)
-      (chat-handler ch "iyye")
-      )
+      (chat-handler ch "iyye"))
     (enqueue ch (wrapped-sync-app request))))
-
 (defroutes app-routes
            "Routes requests to their handler function. Captures dynamic variables."
            (GET ["/chat/iyye"] {}
-                (wrap-aleph-handler chat))
+             (wrap-aleph-handler chat))
            (GET ["/"] {} "To access Iyye, go to /chat/iyye <a href=\"http://localhost:8080/chat/iyye\">iyye chat</a>")
            ;;Route our public resources like css and js to the static url
            (route/resources "/static")

     (include-js "/static/javascripts/web_socket.js")
     (include-js "/static/javascripts/app.js")]))

; move to iyye!
(defn chat-init [ch]
  "register callback for receive msg"
  ;(receive-all ch #(println "message: " % ":" ch))
  )

(def chat-channel (ref ()))

(defn chat-handler [ch room]
  "Relays messages into a chat room. If it doesn't
  exist create a new channel"
  (let [chat (named-channel room chat-init)]
    (siphon chat ch)
    (siphon ch chat)))

(defn send-msg [msg]
  (enqueue @chat-channel (str "iyye> " msg)))


(defn sync-app [request]
  "Rendered response of the chat page"
  {:status 200

    ; This sets the correct file type for js includes used by hiccup
        (ring.middleware resource file-info)
        (hiccup core page))
  (:require [compojure.route :as route]
            [iyye.ioframes :as bios]
            [clojure.tools.logging :as log]))

(defn page []
  "HTML page rendered using Hiccup. Includes the css and js for websockets."
