guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Streaming responses with Guile's web modules


From: Roel Janssen
Subject: Streaming responses with Guile's web modules
Date: Tue, 18 Sep 2018 21:42:31 +0200
User-agent: mu4e 1.0; emacs 26.1

Dear Guilers,

I'd like to implement a web server using the (web server) module, but
allow for “streaming” results.  The way I image this would look like,
is something like this:

(define (request-handler request body)
  (values '((content-type . (text/plain)))
          ;; This function can build its response by writing to
          ;; ‘port’, rather than to return the whole body as a
          ;; string.
          (lambda (port)
            (format port "Hello world!"))))

(run-server request-handler)

Is this possible with the (web server) module?  If so, how?
If not, what would be a good starting point to implement this?

Kind regards,
Roel Janssen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]