Remoting Options

There are a number of options on how remoting is handled by DWR, the method and verb should be transparent to the user, but might have different browser side-effects. Generally speaking DWR will pick the right method for you, but these options might be useful to get around unwanted browser side effects.

dwr.engine.setAsync(flag)

Supported by DWR 1.1 and above.

Do we ask the XHR object to be asynchronous? The default is true. Warning: This option will be ignored if you are using IFrame or ScriptTag remoting (see below) and is often generally a bad idea to change it to false because it can make your browser slow to respond.

To set the synchronisity on a global level:

dwr.engine.setAsync(true);

Or to set it on a call level:

Remote.method(params, {
  callback:function(data) { ... },
  async:true
});

Or to set it on a batch level:

dwr.engine.beginBatch();
Remote.method1(params, callback1);
Remote.method2(params, callback2);
dwr.engine.endBatch({
  async:true
});