[racket] Web server: Disable timeout?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Mar 30 14:07:20 EDT 2012

There is a parameter called the initial-connection-timeout and you can
give it +inf.0 which causes it to be forever in the future.

Jay

On 3/29/12, Michael W <mwilber at uccs.edu> wrote:
> 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
>          web-server/http
>          (only-in web-server/dispatchers/dispatch-pathprocedure [make
> path]))
>
> (serve
>  #:listen-ip #f
>  #:port 8080
>  #:dispatch
>  (path "/foo"
>        (λ(request)
>          (response
>           200 #"OK"
>           (current-seconds) TEXT/HTML-MIME-TYPE
>           (list)
>           (λ(op)
>             (let loop ([i 0])
>               (fprintf op "~a\n" i)
>               (flush-output op)
>               (sleep 1)
>               (loop (add1 i))))))))
>
> (do-not-return)
>
>
> --
> Onward,
>     _mike
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>


-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.