[racket] Web server: Disable timeout?
Hm. Thanks for the websockets link. Is it possible to do that
with HTTP alone, as a fallback?
By COMET, do you mean where the client disconnects and reconnects
every so often? That's possible, and practical even, with the
existing timeout behavior in the web server. I'm just seeing if
it's possible to extend COMET so the client doesn't have to
reconnect.
Here's an example of a service that I'm aiming to reimplement
https://dev.twitter.com/docs/streaming-api/concepts#connecting
See section 6, "Connecting".
10 hours ago, Tom McNulty wrote:
> Michael, perhaps you're interested in Web Sockets. They're a better fit for what you're trying to accomplish. http://docs.racket-lang.org/net/websocket.html?q=websocket
>
> Alternatively, you might try to implement a COMET service, and use long-polling. This is a hack to emulate web socket style two-way communication.
>
> On 2012-03-29, at 7:18 PM, Michael W 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
--
Be sneaky,
_mike