Skip to main content

MQTT.PUBLISH

Publishes either a message or an arbitrary value using a specified Producer and topic. To reference a message from the outbox use the outbox function and to reference a message from the inbox use INBOX. You can use the Function Wizard for this function.

Syntax

=MQTT.PUBLISH(Producer, MessageOrValue, Topic [, QoS, User Properties])

Arguments

NameDescription
ProducerProducer to use for publishing.
MessageOrValueEither an existing message from the outbox or a value to publish.
TopicTopic that is appended to the base topic defined in the Connector.
QoSOptional. Quality of Service. This option defines the reliability of the publish operation. It depends on the used protocol.
User PropertiesOptional. Define Metadata.

Return Value

TRUE, if no error.

Examples

All examples assume a base topic with the value "/cedalo" in the connector.

FunctionResultComment
=MQTT.PUBLISH(|MQTT Producer, "Message", "test")TRUEThis publishes the string value "Message" using the "MQTT Producer" under the topic "cedalo/test"
=MQTT.PUBLISH(|MQTT Producer, OUTBOX("Message"), "test")TRUEThis publishes the outbox message with id "Message" using the "MQTT Producer" and topic "cedalo/test"
=MQTT.PUBLISH(|MQTT Producer, JSON(A1:C2), "test")TRUEThis publishes a JSON object created by the json function using the "MQTT Producer" and topic "cedalo/test"