_Visualforce.Ajax.timeout meaning exactly?

I see there is a

_Visualforce.Ajax.timeout

attribute that can be set for JS remoting. See ref here

I am wondering what is being timed here. The server side time? The client round trip time?

What happens when the timeout is reached client side? I can’t simulate it.

Answer

I believe this is the round-trip time (the time it takes to receive a response back from the server after sending a JavaScript remoting request). When the timeout is reached, the request is abandoned and an error message is returned.

Here’s the release notes for this functionality (see page 209 and after or the copied text below).

Configurable Timeout for JavaScript Remoting Requests

You asked for it! This enhancement is from an idea on the IdeaExchange.
In Summer ’13 the timeout period for JavaScript remoting requests is configurable. In prior releases, the timeout was fixed at
30 seconds, and this remains the default. If your request needs longer to complete, configure a longer timeout, up to 120
seconds.

Configuring JavaScript Remoting Requests

Configure a remoting request by providing an object with configuration settings when you declare the remoting request. For example, the default configuration parameters look like this:

{ buffer: true, escape: true, timeout: 30000 }

These configuration parameters aren’t ordered, and you can omit parameters you don’t want to change from the default.
JavaScript remoting supports the following configuration parameters:

Name    Data Type   Description
---------------------------------------------------------------
buffer  Boolean     Whether to group requests executed close to 
                    each other in time into a single request. The default is true. 

                    JavaScript remoting optimizes requests that are executed close 
                    to each other in time and groups the calls into a single request. 
                    This buffering improve the efficiency of the overall 
                    request-and-response cycle, but sometimes it’s useful to ensure 
                    all requests execute independently.

escape  Boolean     Whether to escape the Apex method’s response. The default is true.

timeout Integer     The timeout for the request, in milliseconds. 
                    The default is 30000 (30 seconds). The maximum is 120000 
                    (120 seconds, or 2 minutes).

The request timeout can also be configured for all requests made by a page, by setting the timeout using the Visualforce remoting object:

<script type="text/javascript">
  Visualforce.remoting.timeout = 120000; // Set timeout at page level

  function getRemoteAccount() {
    var accountName = document.getElementById('acctSearch').value;

    // This remoting call will use the page's timeout value
    Visualforce.remoting.Manager.invokeAction(
      '{!$RemoteAction.AccountRemoter.getAccount}',
      accountName,
      handleResult
    );
  }

  function handleResult(result, event) { ... }
</script>

Override a page-level timeout configuration on a per-request basis by setting the timeout in the configuration object for that request, as described above.

Attribution
Source : Link , Question Author : More Than Five , Answer Author : Matt K

Leave a Comment