On Wed, Apr 8, 2009 at 7:08 AM, Lothar Kimmeringer <j...@kimmeringer.de>wrote:

>
> petrus schrieb:
>
> > Is there a possibility in GWT to communicate asynchronously from
> > server to client?
>
> The term used in general for that is Server Push. A technique
> for that is called "Comet", so if you search "Comet GWT" with
> the search engine of your choice, you should come up with a
> couple of results.
>
> > The only solution which I've found is to use Timer as it's showed
> > there
> http://www.gwtapps.com/doc/html/com.google.gwt.user.client.Timer.html
> > , but then calls will be synchronous. What solution do you recommend?
>
Timers are best for scheduling period tasks like animation.  DeferredCommand
for background processing.

>
>
> Calls in GWT are always synchronously, independent of the way
> they are initiated.

Actually, they are always asynchronous.  They are single threaded though if
that's what you meant.  Anyways, GWT RPC is the way to invoke server code
(RequestBuilder for generic AJAX queries against JSON services & whatnot).
Give it your AsyncCallback which gets invoked when the call returns from the
server.


> But if you solve it using a Timer you should
> set a flag if a request is already in progress to make sure that
> only one requests happen at the same time.

Again - not the right pattern.  Do your call in the onFailure/onSuccess
methods of your callback.  That'll implicitly guarantee 1 outstanding call
at any time.

>
>
>
> Regards, Lothar
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to