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:
From the side panel to the main stage, use the
MeetSidePanelClient.notifyMainStage
method.From the main stage to the side panel, use the
MeetMainStageClient.notifySidePanel
method.The
payload
length must conform to its specified size limit.
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.