[racket] Web server: Disable timeout?

From: Michael W (mwilber at uccs.edu)
Date: Thu Mar 29 21:18:43 EDT 2012

So is it possible to disable the timeout on the web server? Or is
this a /very bad idea/?

Right now I'm constructing my own dispatcher chain with the
low-level server API. My intent is to build a streaming HTTP
service similar to the Twitter streaming API that will send a
short one-line message to connected clients every few seconds
forever. The server insists on timing out after a minute or so.

Try this example. Run

curl http://localhost:8080/foo

and watch the clock count up.

This certainly isn't very idiomatic, but I don't want the
namespace-isolation shenanigans that servlets enforce. Is there a
better way?

#lang racket

(require web-server/web-server
         (only-in web-server/dispatchers/dispatch-pathprocedure [make path]))

 #:listen-ip #f
 #:port 8080
 (path "/foo"
          200 #"OK"
          (current-seconds) TEXT/HTML-MIME-TYPE
            (let loop ([i 0])
              (fprintf op "~a\n" i)
              (flush-output op)
              (sleep 1)
              (loop (add1 i))))))))



Posted on the users mailing list.