Skip to main content

SendMQTTMessage

Structure

SendMQTTMessage(sHost, sPort, sUser, sPassword, sClient, sTopic, bSSL, sMessage)

Parameters

ParameterTypeDescription
sHostStringHost of the server to connect to.
sPortStringPort to send the message to.
sUserStringUser to connect as
sPasswordStringPassword to connect as
sClientStringClient ID to use
sTopicStringTarget Topic to send message to
bSSLBooleanWhether to use SSL when connecting
sMessageStringThe message to send.

Return value

"Message Sent." or error message describing the problem sending.

Description

This function connects to a server using the MQTT protocol and attempts to send a message to it. It always uses a clean session with QoS level 2.

Example

SendMQTTMessage("localhost", "1883", "", "", "IndyClient", "DemoTarget", false, "Test message from IndySoft")