WWW or XMLHttpRequest timeout

Hi

My webgl port is facing a lot of trouble, but it’s getting solved one by one and I hope I have something working soon.
This last problem is a little bit annoying.
I download relatively large files (around 1MB) from the server, but it randomly fails and there was no rule to failure, it was just random.

I went to the generated JS files and put the error description to understand what’s going on, and I found out it was connection time out error.

http.onerror = function http_onerror(e) {
              HandleError ("Unknown error. " + e.toString());
          };

How can I set the XMLHttpRequest timeout from the C# code or how can I solve the problem?
I guess a lot of developers download large files from server with WebGL or Unity Player clients.

Any help is greatly appreciated.
Thanks for advance.

I solved the problem by changing the resulting JS file from

_JS_WebRequest_SetTimeout(($lcssa8|0),5000);

To

_JS_WebRequest_SetTimeout(($lcssa8|0),60000);

But it’s not so practical to change the JS after each build.
Any help is greatly appreciated.

Does this occur with Unity 5.1.1p1 ?

@Marco-Trivellato
Thank you for your reply.
I am working with 5.1.1f1

I wrote a small code to automate the timeout replacement process, it might be useful for some people.

http://www.stranger-games.com/game-development-bolg/how-to-download-large-files-with-unity-webgl-without-timeout/

5.1.1f1 is not the same as 5.1.1p1, which should indeed fix this issue.

1 Like

@jonas-echterhoff_1
Thank you! I will give 5.1.1p1 a shot