      (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

      (wrap-resource "public")
      (wrap-file-info)))


(defn chat [ch request]
  "View handler that handles a chat room. If it's not

  (if (:websocket request)
    (dosync
      (ref-set chat-channel ch)
      (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))
           (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")
