OrgPad logo

Embed messaging

Created by Pavel Klavík

Embed messaging

To send messages, website id has to be set!

image

Messages can be sent from embedded websites to OrgPad

Use window.postMessage, see https://developer.mozilla.org/en-US/docs/Web/API/Window/message_event.

Alice

Bob

Location selector

Setting location

Displays the given location in the opened OrgPage:

{
"type": "set-location",
"location": <location-id>
}

Sending a message to another embed

Sends a message to another embedded website whose id is <target-id>. The website receives <arbitrary data> as message JS event.

{
"type": "send-message",
"target": <target-id>,
"message": <arbitrary data>
}

If the embed is not currently visible, the cell opens first and receives the message after embed loads.

Try out chat between embeds

Peter

Kate

Github with examples

We have created two examples you can see in this document:

https://github.com/JanSuran03/orgpad-embed-messaging