# Receive

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.Receive>

{% 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>                                                                                                                                                                                                                                                                                                                                                                                           |
| ReceivingTime : `Int32`             | <p>Specifies how many seconds the task (client) will live and process messages.</p><p><br>Default: <code>-</code><br>Example: <code>10</code></p>                                                                                                                                                                                                                                                                                                                                             |
| ClientId : `String`                 | <p>The client (session) identificator. This will allow to collect messages from an existing session</p><p><br>Default: <code>-</code><br>Example: <code>3fa85f64-5717-4562-b3fc-2c963f66afa6</code></p>                                                                                                                                                                                                                                                                                       |
| Topic : `String`                    | <p>The topic the client subscribes to when connecting.</p><p><br>Default: <code>-</code><br>Example: <code>example topic</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>-</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>                                                                                                                                      |
| 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>                                                                                                |
| MessagesList : `ConcurrentQueue<String>` | <p>All messages received from the broker in this session.<br>Example: <code>\["message1", "message2"]</code></p>                                                                                                                       |
| CurrentClientId : `String`               | <p>The MQTT client ID. Used to restore a previously opened session to receive buffered messages. When making a new connection, pass it to receive buffered messages.<br>Example: <code>3fa85f64-5717-4562-b3fc-2c963f66afa6</code></p> |
| {% endtab %}                             |                                                                                                                                                                                                                                        |

{% tab title="Changelog" %}

## Changelog

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

#### Added

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