diff --git a/types/chromecast-caf-receiver/cast.framework.d.ts b/types/chromecast-caf-receiver/cast.framework.d.ts index f30ce78169..923c1c36b5 100644 --- a/types/chromecast-caf-receiver/cast.framework.d.ts +++ b/types/chromecast-caf-receiver/cast.framework.d.ts @@ -1204,9 +1204,9 @@ export class CastReceiverContext { removeEventListener(type: system.EventType, handler: EventHandler): void; /** - * Sends a message to a specific sender. + * Sends a message to a specific sender or broadcasts it to all connected senders (to broadcast pass undefined as a senderId). */ - sendCustomMessage(namespace: string, senderId: string, message: any): void; + sendCustomMessage(namespace: string, senderId: string | undefined, message: any): void; /** * This function should be called in response to the feedbackstarted event if the application diff --git a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts index bff9e9d75f..736fce3537 100644 --- a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts +++ b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts @@ -144,6 +144,14 @@ cast.framework.CastReceiverContext.getInstance().addEventListener( () => '¡hola!', ); +// send custom message to specific sender +cast.framework.CastReceiverContext.getInstance() + .sendCustomMessage('custom-namespace', 'sender-id', {}); + +// broadcast custom message to all connected senders +cast.framework.CastReceiverContext.getInstance() + .sendCustomMessage('custom-namespace', undefined, {}); + const loadingError = new cast.framework.events.ErrorEvent(DetailedErrorCode.LOAD_FAILED, 'Loading failed!'); // PlayerManager message interceptors