Message Handling

Learn how Custom Pods can communicate with other components of a room using Messages.

Sending Messages

Each participant loads their own instance of the pod you build. The documentation reference outlines all of the Methods, Events, and Properties available in the Custom Pod SDK. The core functionality is sending messages to other instances of the pod and listening for those messages from other pods. In this way, a custom pod can communicate with other instances of itself.

There are two functions that enable this:

dispatchSyncMessage sends messages to other pods. Those messages include:

So, a typical way to send a message might be:

data-slots=heading, code
data-languages=JavaScript

Dispatching Sync Messages

customPodObject.dispatchSyncMessage(
  "update-note",
  "this is my new note text",
  false,
  false
);

By default, only hosts and presenters can send sync messages. To enable participants to send a specific sync messge, use the following syntax in your code for each of the message types they should be able to send:

data-slots=heading, code
data-languages=JavaScript

Allowing participants to dispatch Sync Messages

customPodObject.allowParticipantPublish(
    "update-note",
    true
);

Stateful vs Delta Messages

To determine whether your message is a Delta message or a Stateful message, consider the following:

So for a chat application, the Sync Messages to set an option or show who is typing a message would be stateful, but each chat message would be a delta message. In general, the large majority of your messages will be stateful and isDelta should be false.

Receiving Messages

The pod you create can listen for messages sent by the Adobe Connect room as well as from other instances of itself.

syncMessageReceived will listen for messages sent by other instances of the pod. It includes a payload with an object that includes the message name and message value sent from the dispatchSyncMessage call. You can use these values to synchronize your pod.

data-slots=heading, code
data-languages=JavaScript

Receiving Sync Messages from other pod instances

function syncMessageReceived(evt) {
    if (evt.msgNm ==="update-note") {
    document.getElementById("notes") += evt.msgVal
    }
    }