Conduit API
Case Study
SendMessage
 
This function is used to send a message to an app (on the same toolbar/engine) using the key the recipient app was previously registered with.Messages can be sent between HTML apps, or from a web page to app.
Notes:
  • The registered app should remain open in order to receive messages.
  • This function should be used along with the "RegisterForMessaging()" function.
  • In order to send a message from a web page, you must include the web page API code on the page that sends the message
 
SendMessage(key, data)
 
Parameter Description Range Type
Key The key that the recipient app uses for registration Not null or empty string string
Data Text message that will be sent to the recipient app Not null or empty string string
 
  • Boolean (success or failure)
  • Recipient’s EBMessageRecieved(nickname, strMsg) event is invoked
 
This function can be used with HTML app, gadget window, and from a web page. *Notice: API methods must be invoked after the web page has triggered the "onload" event.
 
This example demonstrates message passing between two apps. Pressing on the "Register" button registers App1 for messaging with a key "event1". Pressing on the "Send message" button sends message from App2 to App1 using the "event1" key. As a result, the event function EBMessageRecieved(nickname, strMsg) is called with nickname "event1".

The following sample send a message from a web page on the mainframe the user is visiting to the app. in order to send the message, you must include the ToolbarAPI.js file at the head of the document that sends the message: