Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Answer a GET request with two chunks of data sent 2 seconds apart
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
MHOOO  
View profile  
 More options Jul 30 2011, 12:19 pm
From: MHOOO <thomas.karol...@googlemail.com>
Date: Sat, 30 Jul 2011 09:19:22 -0700 (PDT)
Local: Sat, Jul 30 2011 12:19 pm
Subject: Answer a GET request with two chunks of data sent 2 seconds apart
Hello everybody,

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Reeves  
View profile  
 More options Jul 30 2011, 2:56 pm
From: James Reeves <jree...@weavejester.com>
Date: Sat, 30 Jul 2011 19:56:05 +0100
Local: Sat, Jul 30 2011 2:56 pm
Subject: Re: Answer a GET request with two chunks of data sent 2 seconds apart
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"))))

- James


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MHOOO  
View profile  
 More options Jul 30 2011, 9:10 pm
From: MHOOO <thomas.karol...@googlemail.com>
Date: Sat, 30 Jul 2011 18:10:41 -0700 (PDT)
Local: Sat, Jul 30 2011 9:10 pm
Subject: Re: Answer a GET request with two chunks of data sent 2 seconds apart
For some reason that does not work: Is the lazy-seq possibly being
realized before sent (element by element) to the client?

On Jul 30, 8:56 pm, James Reeves <jree...@weavejester.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Reeves  
View profile  
 More options Jul 31 2011, 8:38 am
From: James Reeves <jree...@weavejester.com>
Date: Sun, 31 Jul 2011 13:38:46 +0100
Local: Sun, Jul 31 2011 8:38 am
Subject: Re: Answer a GET request with two chunks of data sent 2 seconds apart
On 31 July 2011 02:10, MHOOO <thomas.karol...@googlemail.com> wrote:

> For some reason that does not work: Is the lazy-seq possibly being
> realized before sent (element by element) to the client?

It looks like you need to wrap the ending seq in a lazy-seq too. This
worked for me:

  (GET "/" []
    (lazy-seq
     (cons
      "11111"
      (lazy-seq
       (do (Thread/sleep 2000)
           (list "2"))))))

- James


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MHOOO  
View profile  
 More options Jul 31 2011, 9:58 am
From: MHOOO <thomas.karol...@googlemail.com>
Date: Sun, 31 Jul 2011 06:58:44 -0700 (PDT)
Local: Sun, Jul 31 2011 9:58 am
Subject: Re: Answer a GET request with two chunks of data sent 2 seconds apart
Ah, great - that worked.

Many thanks!

On Jul 31, 2:38 pm, James Reeves <jree...@weavejester.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Lavigne  
View profile  
 More options Aug 6 2011, 9:48 am
From: Eric Lavigne <lavigne.e...@gmail.com>
Date: Sat, 6 Aug 2011 09:48:24 -0400
Local: Sat, Aug 6 2011 9:48 am
Subject: Re: Answer a GET request with two chunks of data sent 2 seconds apart

> I'd like to implement the server side of Google Closure's
> BrowserChannel.

Just noticed a thread on the closure-library-discuss mailing list that may
be helpful for this effort.

A couple days ago, David Turnbull <dturnb...@gmail.com> announced a Ruby
implementation of the server side of BrowserChannel.

     https://github.com/dturnbull/browserchannel

http://groups.google.com/group/closure-library-discuss/browse_thread/...

The source code is short and readable, and a translation to Clojure may be
easier than writing from scratch.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »