Skip to main content
Version: 8.1

Accept the result from a subscriber module (broadcast message)

Level: intermediate
Example

Implement the MessageWithResultBroadcast broadcast message in the module. The message must have the Publish direction and accept the result from a subscriber module.

Example that implements the MessageWithResultBroadcast broadcast message
...
/* Collection of the configuration message objects. */
messages: {
...
"MessageWithResult": {
mode: Terrasoft.MessageMode.PTP,
direction: Terrasoft.MessageDirectionType.PUBLISH
}
}
...
processMessages: function() {
...
var arg = {};
/* Publish messages and receive the result of their handling by the subscriber module. The result property is added to the object in the subscriber handler method. The property stores the handling result. */
this.sandbox.publish("MessageWithResultBroadcast", arg, ["resultTag"]);
/* Display the result at the browser console. */
console.log(arg.result);
}
...