First widget ever.
When a web request is done and after the callback function finishes, the simulation just stops. The onUpdate functions runs no more and it looks like there is nothing else happening. Am I missing something in my callback function? or is it the way I handle the data receved the problem? Or maybe is a configuration issue? Here is the code:
module myModule { var _response; var RequestInProgress = false; public function request(rest_method,type,id,headers,body) { if (RequestInProgress) { return 0; } var updateCallback = new Lang.Method(myModule, :onReceive); //Stuff... Communications.makeWebRequest(url,body,options,updateCallback); RequestInProgress = true; return 0; } public function onReceive (responseCode,data) { RequestInProgress = false; if (responseCode == 200) { _response = data.get("data"); } else { System.println("Error " + responseCode); } } }
I know the request works because I can print in console the reponse during the onRecieve function. I bet is something really obvious but I can't find it.