Skip to main content
Version: Streamsheets 2.5

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.
QoS (optional)Quality of Service. This option defines the reliability of the publish operation. It depends on the used protocol.
User Properties (optional)Define Metadata.

Return

TRUE, if no error.

Examples

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

FormulaResultComment
=MQTT.PUBLISH(|MQTT Producer,JSON(A1:B2),"test")
TRUEThis publishes a JSON object created by the json function using the "MQTT Producer" and topic "cedalo/test"
=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"