© 2014 Samsung Electronics Co., Ltd. All rightsreserved.
Samsung Web API Web applications can communicate with other Web or native applications using the MessagePort API. The message data type for the communication is map data, which consists of a string key and value pair.
You can send and receive messages through 2 types of message ports:
To receive messages from other applications, you must register a callback function to the local message port.
The local message port information can be sent to another application for bi-directional communication.
You can retrieve the instances of the LocalMessagePort and RemoteMessagePort interfaces with the requestLocalMessagePort() and requestRemoteMessagePort() methods of the webapis.messageport object.
A message port supports sending and receiving methods:
To receive response messages from the other application, your application can attach a local message port while sending the message. You can receive response messages using the callback method that is registered through addMessagePortListener() method of the LocalMessagePort interface.
Figure: Message port communication
You can communicate only with a trusted application that is signed with the same certificate as your application, using the instances of the LocalMessagePort and RemoteMessagePort interfaces that are retrieved by the requestTrustedLocalMessagePort() and requestTrustedRemoteMessagePort() methods of the webapis.messageport object.
Figure: Trusted message ports