diff options
Diffstat (limited to 'guix-build-coordinator/client-communication.scm')
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index d9f2c88..937b679 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -493,6 +493,25 @@ '())) #:threshold 10))) (render-json submit-build-result)))) + (('GET "events") + (list (build-response + #:code 200 + #:headers '((content-type . (text/event-stream)))) + (lambda (port) + (build-coordinator-listen-for-events + build-coordinator + (lambda (event-name data) + (display + (simple-format #f "event: ~A\ndata: ~A\n\n" + event-name + (scm->json-string data)) + port) + (force-output port) + ;; TODO because the chunked output port doesn't call + ;; force-output on the underlying port, do that here. We + ;; want this event to be sent now, rather than when some + ;; buffer fills up. + (force-output (request-port request))))))) (_ (render-json "not-found" |