# Send

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Unknown

Source code: <https://github.com/FrendsPlatform/Frends.MQTT/tree/main/Frends.MQTT.Send>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Host : `String`                     | <p>The address of the MQTT broker.</p><p><br>Default: <code>-</code><br>Example: <code>broker\_host</code></p>                                                                                                                                                                                                                                                                                                                                                                                |
| BrokerPort : `Int32`                | <p>The port of the MQTT broker.</p><p><br>Default: <code>-</code><br>Example: <code>1883</code></p>                                                                                                                                                                                                                                                                                                                                                                                           |
| Topic : `String`                    | <p>The topic to publish the message to.</p><p><br>Default: <code>-</code><br>Example: <code>your\_topic</code></p>                                                                                                                                                                                                                                                                                                                                                                            |
| Message : `String`                  | <p>The message to be published.</p><p><br>Default: <code>-</code><br>Example: <code>your\_message</code></p>                                                                                                                                                                                                                                                                                                                                                                                  |
| UseTls12 : `Boolean`                | <p>Whether to use TLS authentication</p><p><br>Default: <code>-</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                     |
| QoS : `QoS`                         | <p>The Quality of Service (QoS) level for the MQTT session.</p><p>Possible values:</p><ul><li><code>AtMostOnce</code>:</li></ul><p>The Quality of Service (QoS) level for the MQTT session.</p><ul><li><code>AtLeastOnce</code>:</li></ul><p>The Quality of Service (QoS) level for the MQTT session.</p><ul><li><code>ExactlyOnce</code>:</li></ul><p>The Quality of Service (QoS) level for the MQTT session.</p><p><br>Default: <code>-</code><br>Example: <code>QoS.AtMostOnce</code></p> |
| Username : `String`                 | <p>Username for authentication.</p><p><br>Default: <code>-</code><br>Example: <code>testuser</code></p>                                                                                                                                                                                                                                                                                                                                                                                       |
| 🗝Password : `String`               | <p>Password for authentication.</p><p><br>Default: <code>-</code><br>Example: <code>Password123</code></p>                                                                                                                                                                                                                                                                                                                                                                                    |
| AllowInvalidCertificate : `Boolean` | <p>When true, allows connections even if the server's TLS certificate is invalid (e.g., self-signed,</p><p>expired, or hostname mismatch). WARNING: This reduces security and should only be used in</p><p>development/testing environments or when connecting to internal servers with self-signed certificates.</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                     |
| {% endtab %}                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

{% tab title="Result: Result" %}

| Name                | Description                                                                                                                             |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean` | <p>Whether connection to the MQTT broker was successful or not.<br>Example: <code>true</code></p>                                       |
| Data : `String`     | <p>Returns a confirmation message on success.<br>Example: <code>Message sent</code></p>                                                 |
| Error : `String`    | <p>Error(s) if connecting to broker failed. Returns an empty string if no errors exist.<br>Example: <code>Connection refused</code></p> |
| {% endtab %}        |                                                                                                                                         |

{% tab title="Changelog" %}

## Changelog

### \[1.0.0] - 2025-04-07

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
