फ़्रेम-टू-फ़्रेम मैसेज सेवा का इस्तेमाल करें
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस पेज पर बताया गया है कि साइड-पैनल iframe में चल रहे ऐड-ऑन से, क्लाइंट-साइड पर मैसेज कैसे भेजे जाते हैं. साथ ही, यह भी बताया गया है कि मुख्य स्टेज iframe में चल रहे ऐड-ऑन से क्लाइंट-साइड पर मैसेज कैसे भेजे जाते हैं. फ़्रेम-टू-फ़्रेम मैसेजिंग सिर्फ़ क्लाइंट साइड पर होती है. इसलिए, मैसेज तुरंत डिलीवर हो जाते हैं.
कोई मैसेज भेजने के लिए:
- साइड पैनल से मुख्य स्क्रीन पर ले जाने के लिए,
notifyMainStage()
तरीके का इस्तेमाल करें.
await sidePanelClient.notifyMainStage("YOUR_MESSAGE");
- मुख्य स्टेज से साइड पैनल पर ले जाने के लिए,
notifySidePanel()
तरीके का इस्तेमाल करें.
await mainStageClient.notifySidePanel("YOUR_MESSAGE");
payload
की लंबाई, तय की गई साइज़ की सीमा के मुताबिक होनी चाहिए.
मैसेज पाने के लिए, ऐड-ऑन को frameToFrameMessage
कॉलबैक की सदस्यता लेनी होगी. यहां दिए गए कोड सैंपल में, frameToFrameMessage
कॉलबैक के लिए सदस्यता लेने का तरीका बताया गया है:
sidePanelClient.on('frameToFrameMessage', (arg: FrameToFrameMessage) => {
// YOUR_CODE
});
GitHub पर मौजूद"ऐनिमेशन" सैंपल ऐड-ऑन में, फ़्रेम-टू-फ़्रेम मैसेजिंग का पूरा उदाहरण शामिल है. गतिविधि शुरू होने के बाद, जब भी उपयोगकर्ता कोई इनपुट बदलता है, तो साइड पैनल मुख्य स्टेज को सूचना देता है.
मुख्य स्टेज भी अपडेट की गई स्थिति पाने के लिए, frameToFrameMessage
कॉलबैक की सदस्यता लेता है.
नोट
मीटिंग में शामिल किसी व्यक्ति के भेजे गए मैसेज, सिर्फ़ उसी व्यक्ति को दिखते हैं. मीटिंग में शामिल अन्य लोगों को मैसेज भेजने या उन्हें किसी ऐड-ऑन की स्थिति के बारे में बताने के लिए, ऐड-ऑन की स्थिति शेयर करने का तरीका जानें.
मैसेज को सिर्फ़ एक बार डिलीवर करने की कोशिश की जाती है. मैसेज पाने के लिए, मैसेज पाने वाले पैनल का खुला होना ज़रूरी है. साथ ही, मैसेज भेजे जाने से पहले, ऐप्लिकेशन को कॉलबैक के लिए सदस्यता लेनी होगी.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-29 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-29 (UTC) को अपडेट किया गया."],[],[],null,["# Use frame-to-frame messaging\n\nThis page describes how to send messages on the client side from an\nadd-on running in the\n[side-panel](/workspace/meet/add-ons/guides/overview#side-panel) iframe to an\nadd-on running in the [main\nstage](/workspace/meet/add-ons/guides/overview#main-stage) iframe. Frame-to-frame\nmessaging only occurs on the client side, so message delivery is near\ninstantaneous.\n\nTo send a message:\n\n- From the side panel to the main stage, use the [`notifyMainStage()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetsidepanelclient.notifymainstage) method.\n\n await sidePanelClient.notifyMainStage(\"\u003cvar translate=\"no\"\u003eYOUR_MESSAGE\u003c/var\u003e\");\n\n- From the main stage to the side panel, use the [`notifySidePanel()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetmainstageclient.notifysidepanel) method.\n\n await mainStageClient.notifySidePanel(\"\u003cvar translate=\"no\"\u003eYOUR_MESSAGE\u003c/var\u003e\");\n\nThe [`payload`](/workspace/meet/add-ons/reference/websdk/addon_sdk.frametoframemessage.payload)\nlength must conform to its specified size limit.\n\nTo receive the message, the add-on must subscribe to\nthe\n[`frameToFrameMessage`](/workspace/meet/add-ons/reference/websdk/addon_sdk.addoncallbacks.frametoframemessage)\ncallback. The following code sample shows how to subscribe to a\n`frameToFrameMessage` callback: \n\n sidePanelClient.on('frameToFrameMessage', (arg: FrameToFrameMessage) =\u003e {\n // YOUR_CODE\n });\n\nThe [\"Animation\" sample add-on on GitHub](https://github.com/googleworkspace/meet/tree/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js)\nincludes a full example of frame-to-frame messaging. After the activity starts,\nthe side panel [notifies the main stage whenever the user changes an input](https://github.com/googleworkspace/meet/blob/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js/src/app/activitysidepanel/page.tsx#L27).\nThe main stage also [subscribes to the `frameToFrameMessage` callback](https://github.com/googleworkspace/meet/blob/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js/src/app/mainstage/page.tsx#L43)\nto receive updated state.\n\nNotes\n-----\n\n- Frame-to-frame messages sent by a given participant are *only* visible by\n that same participant. To send messages or state to other participants,\n learn how to [share add-on\n state](/workspace/meet/add-ons/guides/collaborate-in-the-add-on#collaboration).\n\n- Message delivery is only attempted once. To receive messages, the receiving\n panel must be open and the app must subscribe to the callback before the\n message is sent.\n\nRelated topics\n--------------\n\n- [Implement the Co-Doing API](/workspace/meet/add-ons/guides/use-CoDoingAPI)"]]