I'd like to implement the server side of Google Closure's
BrowserChannel. For this however I need to be able to answer to a GET
request with two chunks of data, which are being sent 2 seconds apart.
Basically something like the following:
- User U sends GET request to Server S
- S receives GET request from U, accepts it and writes "11111" back to
U *without closing the connection*
- S waits 2 seconds
- S writes "2" back to U
- S closes the GET connection
- U receives the data
Anyone has a idea how I could achieve this with compojure?
On 30 July 2011 17:19, MHOOO <thomas.karol...@googlemail.com> wrote:
> I'd like to implement the server side of Google Closure's > BrowserChannel. For this however I need to be able to answer to a GET > request with two chunks of data, which are being sent 2 seconds apart. > Basically something like the following: > - User U sends GET request to Server S > - S receives GET request from U, accepts it and writes "11111" back to > U *without closing the connection* > - S waits 2 seconds > - S writes "2" back to U > - S closes the GET connection > - U receives the data
> Anyone has a idea how I could achieve this with compojure?
You could use a lazy seq, e.g.
(lazy-seq (cons "11111" (do (Thread/sleep 2000) (list "2"))))
> On 30 July 2011 17:19, MHOOO <thomas.karol...@googlemail.com> wrote:
> > I'd like to implement the server side of Google Closure's
> > BrowserChannel. For this however I need to be able to answer to a GET
> > request with two chunks of data, which are being sent 2 seconds apart.
> > Basically something like the following:
> > - User U sends GET request to Server S
> > - S receives GET request from U, accepts it and writes "11111" back to
> > U *without closing the connection*
> > - S waits 2 seconds
> > - S writes "2" back to U
> > - S closes the GET connection
> > - U receives the data
> > Anyone has a idea how I could achieve this with compojure?