Use frame-to-frame messaging

This page describes how to send messages from an add-on running in the side-panel iframe to an add-on running in the main stage iframe.

To send a message:

To receive the message, the add-on needs to subscribe to the AddonCallbacks.frameToFrameMessage callback. The following code sample shows shows how to subscribe to a AddonCallbacks.frameToFrameMessage callback:

sidePanelClient.on('frameToFrameMessage', (arg: FrameToFrameMessage) => {
    // YOUR_CODE
});

For more information, see Subscribe to callbacks.

Notes

  • Frame-to-frame messaging is entirely client side and near instantaneous.
  • Message delivery is only attempted once. In order to receive messages, the receiving panel needs to be open and the app needs to subscribe to the callback before the message is sent.