The InterAppCommunicator API enables sending events from one web application to another web application running within the Hybrid Container. It also enables broadcasting the event to all web applications running within the client. The events, including broadcast events, are not delivered to the sender application.
In order for the recipient web application to be able to receive events from other applications, it has to be registered using the addListener method.
Depending on the settings, if the recipient application is not running, Hybrid Container may initiate and notify it about the event. However, since the receiving web application may be removed before it is able to receive and process the event or may not be registered for event receipt, it can not be guaranteed that the event will be delivered. Also, events that have not been delivered will not be persisted.
Please refer to the InterAppCommunicator article for detailed information on available API and its methods.
In order to notify the recipient application about the event, Hybrid Container may attempt to
start it when it is not running. The APIs behavior depends on the setting of the
start
parameter passed by the sendEvent method.
If the start
parameter is set to "false", the API mechanism
will:
call the onFailure
callback, returning the
FAILURE_CODES_APP_DOES_NOT_EXIST error code, if the recipient web application does not
exist (e.g. it has been removed),
call the onFailure
callback, returning the
FAILURE_CODES_APP_IS_NOT_STARTED error code, if the recipient web application is not
started,
push the event to the bridge of the destination web application and call the
onSuccess
callback.
If the start
parameter is set to "true" and the recipient web
application is not running, the API mechanism will:
call the onFailure
callback, returning the
FAILURE_CODES_APP_DOES_NOT_EXIST error code, if the web application does not exist (e.g.
it has been removed),
register for application state changes,
request application start,
put the event to a queue.
Once the recipient web application is started, the events are delivered in the same order they were stored in the queue.
The API does not check it the recipient application has registered a listener to receive
events. The onSuccess
callback is called either immediately after
sending a broadcast event to multiple web applications or once the event is pushed to the
bridge of the specific destination web application.