Alexa.MessageProvider Interface

The MessageProvider interface defines how the Client object sends messages to and receives messages from the device. To work with Client, a device or a mock device must implement this interface.

Implemented by

DefaultMessageProvider

Methods

receive

receive(callback): void

Register the callback for when events from the device are received.

Parameters

Name Type Description
callback (message: Message<any>) => void Function to be called whenever a message is received from the device. Function should take Message as a parameter to receive the contents of the message.

Returns

void


send

send(command, payload?): Promise<MessageSendResponse>

Sends the command and payload to the device or service responsible for handling events.

Parameters

Name Type Description
command string Command name used to route events to the correct device or service handler.
payload? any Data to be used with the command by the device or service.

Returns

Promise<MessageSendResponse>

A promise that contains the send message result once resolved.


Was this page helpful?

Last updated: Nov 20, 2026