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.

I had this problem before on iOS, it seemed to be a caching issue within Safari rather than a Unity issue. You can get around it by modifying your URL each time with a random number.

e.g. Instead of www.google.co.uk/page.php

you do:

www.google.co.uk/page.php?r=78273823

1 Like