Is it possible to pass parameters from server package to client package using RPC?
I have a GWT project in which I have a web interface programmed in the client package and the code that connects to a remote server in the server package. The interface presents certain parameters to the user and he/she has to select them and make a query to the remote server.
I have passed the user-selecte开发者_运维技巧d parameters to the server package using a RPC call, but I would like to know if it is possible to to the inverse operation, because I would like to draw the data retrieved from the server on an embedded Google map (retrieved data is georeferenced) and all this drawing things is done in the client package with pure-GWT classes.
What do you think? Is it possible? Any idea? Do I have to draw the georeferenced data on the client side?
Thanks to all.
you can use jwebscoket or websocket to do RRPC(Reverse RPC).More info is available at http://jwebsocket.org/.
I have seen on this forum: http://markmail.org/message/ksrbkwbhlbgq44yx the following comment... what do you think?
'Reverse' RPC calls into a GWT client are not possible - what you could do is provide a refresh button or have your client poll the server at regular intervals to get the latest data.
Thanks for your help
The thing you are looking for is Server Push Framework/Library. One of them is Comet. Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it. There are many libraries for GWT but here are a few:
http://code.google.com/p/gwteventservice/
http://code.google.com/p/gwt-comet/
http://code.google.com/p/rocket-gwt/wiki/Comet
http://www.jboss.org/errai
http://code.google.com/p/dwr4gwt/
Descriptions:
http://www.jroller.com/masini/entry/a_comet_implementation_for_google
http://wintermuteblog.blogspot.com/2010/01/websphere-gwt-comet.html
If you want the server code to initiate an RPC to send something to the client, you're looking for Server Push or WebSockets.
A much simpler alternative that might work for you is to just have the client poll the server. Given this service:
public interface MapParamsService extends RemoteService {
MapParams getMapParams();
}
you could have the client call getMapParams() every 5 seconds until it returns non-null.
i din get the every part of your question but you can use return type in your rpc method. and there is a shared package were you can create a model class for the userdefined data type you want to return from the server.
精彩评论