- Home /
Delay in accessing recently added data via Web Server
Right now I am accessing data from web server. But main problem I was facing right now it that I can't able to access recent data on the spot. Not always this is happening but mostly it is taking 5 to 10 minutes delay.
If same URL, I paste into browser then I have latest data access over their but Unity have older data to display. After few minutes automatically Unity has latest data.
I want accuracy in data retrieval as browser has. At present I am using following code for fetching data from web server.
WWW www = new WWW (url);
//Load the data and yield (wait) till it's ready before we continue executing the rest of this method.
yield return www;
if (www.error == null) {
//Sucessfully loaded the XML
Debug.Log ("Loaded following XML " + www.text);
} else {
Debug.Log ("ERROR: " + www.error);
}
If any other way exist that can solve my problem then give me help in this.
Answer by siddharth3322 · Jun 13, 2017 at 04:19 PM
Yes I can give at present some help into this problem. Now enough time passed to my asked question but let me share my side experience with you.
Basically I was using same URL to accessing data from web server but many times I didn't able to get updated content that exist on server.
Its replying me same output for certain time duration then after some time it automatically get updated. So for solution purpose whichever URL I require to call multiple times, I have started adding some dummy parameter and values in web request so URL become each time unique.
Then after I was not getting cached response by sending always unique query to web server and latest content in response.
I hope other members can get some help by this reply.
Thank you very much! Can you give some insight in how you add those dummy parameters?
That you require to learn, how to pass argument with web service request. This is only thing, I have did.
Your answer
