Hi Tony, It seems to me that what you're trying to solve has more to do with server-side programming rather than client-side programming in GWT. On the client-side, you have the standard situation where you make a call (either through RPC or the RequestBuilder) and you handle the asynchronous response in the callback, and subsequently do whatever is approriate on the UI side of things. On the server-side, you have a situation where one server needs to wait for another to signal it to return a message back to the client after making a call to an intermediary service. My suggestion would be to look into RMI appropriate to your backend technology and have the first server wait on a token that would be set by the second server returning the reply. Once set, it could continue processing a return a reply to the client, as well as unset the token for the next call. You can find a lot more tips on the server-side programming forums approrpriate to your server-side technology.
However, I would be very careful with how long the server-to-server calls take, since you might run into request timeouts if the calls make it so that the server response takes too long. In that case, you could look into using Comet. As for whether JSON or RPC is best for the client to server communication, I would go with GWT RPC if you're using a Java backend. It makes it easy to make calls, pass data objects back and forth, optimize payloads and keep as much of your code base as possible in Java. GWT RPC: http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideRemoteProcedureCalls Hope that helps, -Sumit Chandel On Tue, Jan 20, 2009 at 8:15 AM, tony.p.. <[email protected]> wrote: > > Hello everyone, > > I started a project, which is a client/server application and started > looking at GWT for the front end. GWT looks perfect for the front end, > but I need your advice on the best practice to implement these > components. > > The application has these components: > > 1. an existing data acquisition system (DAS) that sends data every x > minutes, on a tcp/ip port. > 2. server, this is what I'm writing, that will do: > a. Back end 1 (BE1): get the data from the DAS, done this already > with the protocol that the DAS implements. > b. Front end to retrieve the data, with GWT. > c. Back end 2 (BE2) to communicate with the GWT front end: should I > use RPC or JSON? (which is easier and quicker to implement?) > d. From the GWT front end, I want to issue commands to the DAS and > display the response. So the command goes from GWT to BE2 to the DAS. > The DAS replies to BE1. BE1 sends the reply to BE2, then BE2 to GWT to > display it. The issue here is how to handle this async communication, > when the reply comes from BE1 to BE2? > > Thank you in advance. > Tony > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
