networkRequest (params.timeout)

Hi there are two things that I have not clear on the timeout of requests:

1.the documentation says that the default timeout is 30 seconds. But when I make a request:

     if there is no connection the answer (of course error) arrives after about 1-2 seconds

     if there is a connection, the answer arrives after about 3-4 seconds

So what exactly does it refer to?

2.Not knowing the first point I could not test my second question. if I want to set a different timeout time,

   I have to think like in the timers / transition(one second is equal to 1000) or otherwise (one second is equal to       1) This is not clear in the documentation…

Thanks in advance

   

Answer for Question #1

I think the timeout would trigger in scenarios 3 (which you did not list).

Scenario 3 - Request is received by the server, but the server doesn’t respond in a reasonable amount of time.

Answer for Question #2

Are you asking if timeout is measured in seconds or milliseconds?  It is measured in seconds.

Fractional seconds may be OK, but I’d stick with whole numbers.  i.e. To extend to 45-seconds, simply use the number 45.

If that is not what you are asking, please re-phrase the question.  It was pretty hard to read and grok.

Hi,

Unless you’re expecting a very long processing time on your request, you don’t really need to adjust the timeout from the default.

Basically, from my understanding, the timeout is based on a successful request, and if the response is not delivered by the “timeout” the connection will be closed.

Unless you are uploading and processing a large amount of data, and the server is not going to respond within 30 seconds (which would mean a very large payload/processing action) then you can adjust it. But in general usage a server should respond to the request within that time frame.

Again, this is based on a successful request being received by the server.

-dev

@roaminggamer

Sorry for my bad english but you’ve hit the questions. 

As for the #2 all clear.

For the #1 question also following the explanations of @Develephant, I did some tests.

I thought it might be useful to put a shorter timeout (about 10) but the nerworkRequest

 are asynchronous methods so I really think it would be useless…

Answer for Question #1

I think the timeout would trigger in scenarios 3 (which you did not list).

Scenario 3 - Request is received by the server, but the server doesn’t respond in a reasonable amount of time.

Answer for Question #2

Are you asking if timeout is measured in seconds or milliseconds?  It is measured in seconds.

Fractional seconds may be OK, but I’d stick with whole numbers.  i.e. To extend to 45-seconds, simply use the number 45.

If that is not what you are asking, please re-phrase the question.  It was pretty hard to read and grok.

Hi,

Unless you’re expecting a very long processing time on your request, you don’t really need to adjust the timeout from the default.

Basically, from my understanding, the timeout is based on a successful request, and if the response is not delivered by the “timeout” the connection will be closed.

Unless you are uploading and processing a large amount of data, and the server is not going to respond within 30 seconds (which would mean a very large payload/processing action) then you can adjust it. But in general usage a server should respond to the request within that time frame.

Again, this is based on a successful request being received by the server.

-dev

@roaminggamer

Sorry for my bad english but you’ve hit the questions. 

As for the #2 all clear.

For the #1 question also following the explanations of @Develephant, I did some tests.

I thought it might be useful to put a shorter timeout (about 10) but the nerworkRequest

 are asynchronous methods so I really think it would be useless…