Welcome to the CHICKEN Scheme pasting service

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))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which backend storage does qwiki use?
Visually impaired? Let me spell it for you (wav file) download WAV