Setting Timeouts

dwr.engine.setTimeout() and the call and batch level call options object allow you to set timeout values. The global dwr.engine.setTimeout() function does it for all DWR calls. A value of 0 (the default) turns call timeouts off.

The units passed to setTimeout() are milli-seconds. If a call timeout happens, the the appropriate error handler is called.

Example of setting a timeout on a call level:

Remote.method(params, {
  callback:function(data) { alert("it worked"); },
  errorHandler:function(message) { alert("it broke"); },
  timeout:1000
});

If Remote.method() takes more then 1 second to execute, the "it broke" message will be displayed.