views:

64

answers:

3

Hello

I'm implementing a client-server GPS application. Client side is a J2ME midlet that sends GPS location via HTTP/XML to a Java Webservice (Tomcat servlet). The servlet stores positions in SQL database. The other client app is a web browser that can login and see the actual position of midlet using Google Maps. This client is written using GWT. All is deployed on the same Tomcat container. Now I'm wondering how to dynamically update current position in webrowser Google Maps of the mobile so that the client can see how the mobile moves. How to do it in GWT - should I create a timer object in GWT client and asynchronously send HTTP request to server for getting the actual positions? Or is there any mechanism in AJAX/GWT to notify client (web browser) about the data update?

Thanks Dominik

+3  A: 

Regardless of all the talk about "push", the standard HTTP model is still one where the client has to ask the server for updates.

In a GWT app, you should use the well-supported Ajax functionality to request small-granular updates (polling, I guess) from the server at regular intervals (5 seconds, maybe?) and use the newly obtained information to update your map info.

Carl Smotricz
+1 we use a polling technique in a gwt app at work and it works fine.
Dave Paroulek
Could you provide more information about it?
dominolog
+2  A: 

There is a detailed article on the GWT incubator web site about Server Push and how to achieve it with GWT. From the article:

Explains Server Push, sometimes known as 'comet', and how you can achieve this with GWT.

Then, if you take a look at the comments, you can find interested related information and open implementations as gwt-comet, GWTEventService ...

rochb
+2  A: 

I agree with rok.

If your deployment is going to be small enough to be able to support one permanent connection per web browser client go with Server Push/ Hanging RPC/ Long Polling or whatever you want to call it.

Iker Jimenez