Wiring App Interactions
App interactions happen when an event in one app is communicated to other apps in the same page or container, allowing the receiving apps to take appropriate actions based on that event. This is also known as inter-app communication or simply as interaction wiring.
Events are propagated asynchronously between apps using a publish/subscribe paradigm. Event messages belong to topics that correspond to specific types of events. Apps publish or subscribe to topics.
Events and Interactions
The types of events that can be published and the subscribing apps’ interactions include:
| Publisher Events | Subscriber Behavior |
Basic apps | The specific events supported by the views included in the app. For built-in MashZone NextGen views this typically includes user click events for specific nodes within the view. See documentation for each built-in view for details. Built-in and pluggable views may also support row-select events from the underlying Datatable. | Published message payloads can be used to either: Update input parameters for the app to refresh information. Determine row selection. The behavior or visual indications of row selection is specific to each view. One common behavior is to highlight one or more objects within the view. |
Custom apps | Any browser event or custom event defined in the custom app. | Published messages can trigger any type of behavior defined in the subscribing custom app. Message payloads can be used to update app properties or determine row selection, but are not limited to these options. |
Managing Interactions at Runtime
At runtime, the Wiring Manager in MashZone NextGen handles subscriptions and message transmissions for both secured and unsecured apps in a given page or container.
App communication is built on top of the
OpenAjax Hub 2.0 Specification which provides the underlying functionality for securely passing event data between apps. App interactions are implemented using publish and subscription methods from the
MashZone NextGen App API, plus optional configuration in the App Specification to support interactions that are loosely coupled.
Interaction Methods in the MashZone NextGen App API
For custom apps, there are three methods you can use to implement interactions:
publish([topic],message): to publish information about an event to any other apps that have subscribed to that topic. This method is used for both
tightly-coupled and
loosely-coupled interactions.
receive([topic],onMessage,scope): to receive messages for topics that other apps have published in a
loosely-coupled interaction.
subscribe(topic,onMessage,scope): to subscribe to a known topic that is published from another app in a
tightly-coupled interaction.
For detailed information about these methods, see the MashZone NextGenApp API.
The choice of method and any optional configuration needed to implement an interaction depends on whether the interaction is tightly-coupled or loosely-coupled.