Skip to content

Instantly share code, notes, and snippets.

@jaredjenkins
Last active December 16, 2015 10:39
Show Gist options
  • Save jaredjenkins/5421919 to your computer and use it in GitHub Desktop.
Save jaredjenkins/5421919 to your computer and use it in GitHub Desktop.
Polling for completed requests in MonoBehavior
void Update()
{
//the http worker has a method which returns (dequeues)
//an IEnumerable set of completed requests,
//internall it is enqueueing the completed requests
foreach(ApiResponse response in httpWorker.GetCompletedResponses())
{
if(response.Request.RequestCompleteHandler != null)
{
//we want to notify an object that we have completed the request
response.Request.RequestCompleteHandler(response.Request.Url, response.ResponseData);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment