This function sends a message to the Gateway and expects a response. Works in a similar manner to the sendRequest function, except sendRequestAsync will send the request and then immediately return a handle for it. The Request handle has the following methods:
This scripting function has no Client Permission restrictions.
system.util.sendRequestAsync(project, messageHandler, payload, remoteServer, timeoutSec, onSuccess, onError)
String project - The name of the project containing the message handler.
String messageHandler - The name of the message handler that will fire upon receiving a message.
PyDictionary payload - Optional. A PyDictionary which will get passed to the message handler. Use "payload" in the message handler to access dictionary variables.
String hostName - Optional. Limits the message delivery to the client that has the specified network host name.
String remoteServer - Optional. A string representing the target Gateway Server name. The message will be delivered to the remote Gateway over the Gateway Network. Upon delivery, the message is distributed to the local Gateway and clients as per the other parameters.
String timeoutSec - Optional. The number of seconds before the sendRequest call times out.
PyFunction onSuccess- Optional. Should take one argument, which will be the result from the message handler. Callback functions will be executed on the GUI thread, similar to system.util.invokeLater.
PyFunction onError- Optional. Should take one argument, which will be the exception encountered. Callback functions will be executed on the GUI thread, similar to system.util.invokeLater .
Request Handle - The Request object that can be used while waiting for the message handler callback.
As of 7.9.6, the order of parameters changed, and is reflected in the syntax list above. When calling the function by order, the arguments should be passed like so:
In versions 7.9.3, 7.9.4, and 7.9.5 the timeoutSec parameter was at the end:
In either case, passing parameters via keyword arguments can be used across all versions.