This page describes how to get the client object that an add-on needs to communicate with Google Meet.
First, the add-on needs to establish a session:
const session = await window.meet.addon.createAddonSession({
cloudProjectNumber: "CLOUD_PROJECT_NUMBER",
});
From the session, two client objects can be created:
The
MeetMainStageClient
for an add-on running in the main stage, retrievable usingawait session.createMainStageClient()
.The
MeetSidePanelClient
for an add-on running in the side panel, retrievable usingawait session.createSidePanelClient()
.
It's important to retrieve the correct client object for either the main stage
or side panel. If the wrong client is retrieved, the Google Meet Add-ons SDK throws
an exception. To check which iframe (main stage or side panel) the
add-on is running in, use the
MeetAddon.getFrameType
method.
The following code sample shows how to instantiate the main stage client object:
const session = await window.meet.addon.createAddonSession({
cloudProjectNumber: "CLOUD_PROJECT_NUMBER",
});
const mainStageClient = await session.createMainStageClient();
Shared functionality
Some functionality is available in both the MeetMainStageClient
and the
MeetSidePanelClient
, whereas other functionality is specific to a certain
client.
For example, some functionality available in both clients includes:
- The
MeetAddonClient.getCollaborationStartingState
method that gets information about the initial state of the add-on when the participant accepts the invitation to collaborate. - The
MeetAddonClient.getMeetingInfo
method that gets details about the meeting in which the add-on is running. - The
MeetAddonClient.getMeetPlatformInfo
method that gets details about the meeting platform on which the add-on is running. - The
MeetAddonClient.setCollaborationStartingState
that sets the initial state of the add-on when the participant accepts the invitation to collaborate. - For a comprehensive list of functionality in both clients, see the
MeetAddonClient
object.
Client-specific functionality
Functionality available only in the
MeetMainStageClient
:
The
MeetMainStageClient.notifySidePanel
sends a message to the side panel. The message can be received by subscribing to the frameToFrameMessage callback in the side panel.The
MeetMainStageClient.loadSidePanel
method opens the side-panel iframe. The iframe source is set to the side-panel URL from the manifest file.The
MeetMainStageClient.unloadSidePanel
method closes the side-panel iframe. The add-on state isn't retained within Meet when the method is called. It's up to the add-on to persist any add-on state before this method is called.
Functionality available only in the
MeetSidePanelClient
:
- The
MeetSidePanelClient.notifyMainStage
sends a message to the mainStage. The message can be received by subscribing to the frameToFrameMessage callback in the mainstage.