GWT synchronization
- by hdantas
i'm doing a function in gwt
it sends an IQ stanza into a server and has to wait for the server answer
in the function i make the handler that waits for the answer from the server to that IQ stanza
so what i need is for the function to wait until i get the response from the server and after that do other stuff
i'm a beginner in gwt so any thoughts would be great
thanks
public void getServices()
{
IQ iq = new IQ(IQ.Type.get);
iq.setAttribute("to", session.getDomainName());
iq.addChild("query", "http://jabber.org/protocol/disco#items");
session.addResponseHandler(iq, new ResponseHandler()
{
public void onError(IQ iq, ErrorType errorType, ErrorCondition errorCondition, String text)
{
<do stuff>
}
public void onResult(IQ iq)
{
<do stuff>
}
});
session.send(iq);
<after receiving answer do stuff>
}