(ns grub.core (:require [ring.middleware.reload :as reload] [compojure.core :refer [defroutes GET POST]] [compojure.handler :as handler] [compojure.route :as route] [org.httpkit.server :as httpkit] [hiccup [page :refer [html5]] [page :refer [include-js include-css]]] [clojure.core.async :as async :refer [! >!! chan go close! timeout]])) (def out-channels (atom [])) (def channel-id-count (atom 0)) (defn push-grub-to-others [grub my-channel-id] (let [other-channels (fn [] (filter #(not (= (:id %) my-channel-id)) @out-channels))] (go (doseq [{ch :channel} (other-channels)] (>! ch grub))))) (defn push-new-grubs-to-client [c ws-channel] (go (while true (let [grub (Page not found.

")) (def app (let [dev? true] (if dev? (reload/wrap-reload (handler/site #'routes) {:dirs ["src-clj"]}) (handler/site routes)))) (defn -main [& args] (httpkit/run-server app {:port 3000}))