Synopsis
Boolean publishMessage(Object payload)
Parameters
The parameter Object payload has the following properties:
String type – The service type can be one of three message categories "INPUT", "SERVICE", or "WIDGET".
String subject – The subject of the message is the service name and is dependent on the value of the type property as follows:
INPUT is used to publish keyboard and media transport control inputs from the Engine that are not app-specific.
The subject values for the INPUT type are keyboard or mediacontrol. The navigation subject is only valid in the Device Interface.
SERVICE is used to support advanced services such as media launching and others to be specified (TBS).
The subject value for the SERVICE type is medialaunch.
WIDGET is used to send application-specific communication to and from apps. The subject value for the WIDGET type is the emptystring.
The widgetId of the current app is populated in this field by the Engine.
String data – The message payload may or may not be a JSON string depending on the value of the type property as follows:
INPUT supports keyboard and mediacontrol message payloads as JSON-encoded objects.
SERVICE supports medialaunch message payloads as JSON-encoded objects.
WIDGET supports message payload as determined by the app.
Array<String> instanceId – The remote device identifiers that should receive the message. No other devices receive the message. This parameter can
be a
String for a single instanceId, an Array<String> of instanceId(s) or null.
If null, the message is sent to all connected remote devices that are subscribed to messages of the given type and subject.
Returns
Returns true if sending the message is successful. Returns false otherwise.
Description
Uber method that publishes the payload.data message to the devices identified by the payload.instanceId parameter.
Send the message payload to subscribed (or identified) devices so they can handle the message. Messages are limited to 20,480
bytes for the entire message, unless otherwise specified by a device partner.