SSE blocking awful/spiffy - how to fix it? added by arthurmaciel on Sun Jun 22 08:49:23 2014

(use awful spiffy extras data-structures)

(enable-sxml #t)

(define-page "/test"
  (lambda ()
    (add-javascript
     "var source = new EventSource('/sse');
      source.onmessage = function (event) {
          document.body.innerHTML = event.data;
      };")
    ""))

(define-page "/sse"
  (lambda ()
    (let loop ()
      (send-response
       body: (conc "data: " (random 10) "\n\n")
       headers: '((content-type text/event-stream)
		  (cache-control no-cache)
		  (connection keep-alive)))
      (sleep 15)
      (loop))))