Skip to content

IConnection

Namespace: MQTT_Receiver_Worker.MQTT.Interfaces

Interface for MQTT broker connection management.
Provides abstraction for establishing MQTT connections and handling message processing.

public interface IConnection

Properties

IsConnected

Gets a value indicating whether the MQTT client is currently connected.

public abstract bool IsConnected { get; }

Property Value

Boolean

Methods

DisconnectAsync()

Disconnects from the MQTT broker.

Task DisconnectAsync()

Returns

A task that represents the asynchronous operation.

GetConnectionAsync()

Establishes a connection to the MQTT broker and configures message handlers.

Task<IMqttClient> GetConnectionAsync()

Returns

A task that represents the asynchronous operation. The task result contains the connected MQTT client, or null if connection failed.

TryConnectAsync()

Attempts to connect to the MQTT broker.

Task<Boolean> TryConnectAsync()

Returns

A task that represents the asynchronous operation. The task result indicates whether the connection was successful.