             [org.httpkit.timer :refer [schedule-task]]))
 
 (def channel-hub (atom {}))
+
+(defn handle-cors []
+  {:status 204
+   :headers {"Access-Control-Allow-Origin" "*"
+             "Connection" "close"}})
 
 (defn handle-404 []
   {:status 404

                        (swap! channel-hub dissoc channel)))))

(defn app [req]
  (case (:uri req)
    "/connections" (handle-connections)
    "/sse" (handle-sse req)
    (handle-404)))

(defn notify-channels []
  (let [time (System/currentTimeMillis)]

  (with-channel req channel
    (send! channel {:status 200
                    :headers {"Content-Type" "text/event-stream"
                              "Access-Control-Allow-Origin" "*"
                              "Cache-Control" "no-cache"
                              "Connection" "keep-alive"}
                    :body ":ok\n\n"} false)
