Introducing Multicast Poke - triggering CX changes for multiple customers from the cloud
Introducing Multicast Poke - triggering CX changes for multiple customers from the cloud¶
import useBaseUrl from ‘@docusaurus/useBaseUrl’
Today we are launching Multicast Poke, a new primitive and variation of Poke available in Dragonfly. Multicast Poke enables the cloud to dynamically and in near real-time send signals and data to multiple customer mobile client applications. Client Applications can use that data to perform a variety of tasks, like updating the UI with new information.
What is Multicast Poke?¶
Multicast Poke lets our mobile applications receive and take action to triggers sent by the backend cloud architecture. Unlike classic Poke, Multicast Poke works across customers by connecting them to the same interests. For example, Collaborative Playlists can use this to connect customers who are actively viewing the same playlist to receive near-real-time updates to changes others are making. This will help turn playlist collaboration into a more real-time interactive experience.
How can I integrate Poke?¶
Here are the 3 steps for integrating with Multicast Poke:
Define your Multicast Poke data contract
Receive and process your Multicast Pokes on the client
Trigger your Multicast Pokes from the cloud
1. Define your Poke data contract¶
The Multicast Poke message contains 2 fields that are required and a third that is optional. The first field is domain, we need to know what domain the data falls under. The second field is called filter and combined with domain they limit which clients get the Multicast Poke. The third field is called data, and it’s defined by you. It can be undefined, a string or JSON. Your choice.
Let’s say you wanted to send a Multicast Poke when a playlist is updated. You could use this contract:
{
domain: 'PLAYLIST',
filter: 'playlist-id',
data: 'Updated',
}
2. Receive and process your Multicast Pokes on the client¶
The following code example shows how you will import and register to receive a Multicast Poke for a specific domain in a DragonFly page.
import { useMulticastPoke } from '~/stores/Casting/hooks/useMulticastPoke'
const { startPoke, stopPoke } = useMulticastPoke(DOMAIN, filter, handlePoke)
useEffect(() => {
//Add a condition if you need it.
startPoke()
return stopPoke
}, [startPoke, stopPoke])
You should call startPoke as soon as you need to begin receiving them. Typically this will be either when entering a page or the customer has taken a specific action , e.g. hitting button. Similarly you should call stopPoke when the customer leaves a page, the customer has taken a specific action, or the Multicast Poke tells you “there’s no more”.
3. Trigger your Pokes from the cloud¶
The following code shows how you can trigger Multicast Poke using a javascript Lambda:
const FUNCTION = ''; /* The Poke Lambda ARN you need to call */
export const sendPoke = async (domain, filter, data, lambdaClient) => {
try {
const invokeParams = {
FunctionName: FUNCTION,
InvocationType: "RequestResponse",
Payload: JSON.stringify({ domain: domain, filter: filter, data: data }),
};
const invokeCommand = new InvokeCommand(invokeParams);
const response = await lambdaClient.send(invokeCommand);
} catch (error) {
console.error(`Error invoking Lambda function: ${error}`);
throw error;
}
}
Send a Multicast Poke when your cloud services know something happened that a client should or might want to react to.
4. Test¶
Now you’re ready to start testing your Multicast Poke integration! Note you can manually trigger classic Poke and Multicast Poke using AWS console access to a limited-scope role too.
Things to know¶
Poke is primarily designed for Amazon Music experience developers to deliver dynamic experiences with signals from the cloud. It can also be used to improve existing polling experiences like library and playlist synchronization.
Onboarding to develop a POC is as simple updating an allow list with your AWS account number(s). Reach out today to begin onboarding!
Is there a demo or POC?¶
The following video demonstrates a proof of concept for Collaborative Playlists Multicast Poke integration:
What types of data should be sent over Multicast Poke?¶
Multicast Poke is not meant for data that shouldn’t be accessible across customers. Any customer device has the ability to access these messages. If you have data that should be accessible only a single customer then you should probably use classic Poke.
Am I limited to Poking at the Customer ID level?¶
No longer, Multicast Poke offers a new variation. Use the Poke variation that best suits your use case.
None of the Poke variations are at the right level for my use case. Can we have another option?¶
Don’t think it’s a good fit? Reach out and we can discuss variations that might.
How much data can I send?¶
Messages can be as large as 128KB. This is for the entire message, not just your data.
