Search Results for

    Show / Hide Table of Contents

    Class MqttConnector

    This class implements the IMqttConnectable interface and uses the The library MQTTnet internally.

    Inheritance
    System.Object
    MqttConnector
    Implements
    IMqttConnectable
    IConnectable
    IAsyncConnectable
    Namespace: TeleScope.Connectors.Mqtt
    Assembly: TeleScope.Connectors.Mqtt.dll
    Syntax
    public class MqttConnector : object, IMqttConnectable, IConnectable, IAsyncConnectable

    Constructors

    | Improve this Doc View Source

    MqttConnector(MqttSetup)

    The constructor instanciates the internal logging, stores the setup configuration and prepares the internal mqtt client.

    Declaration
    public MqttConnector(MqttSetup setup)
    Parameters
    Type Name Description
    MqttSetup setup

    The setup for the mqtt client.

    Properties

    | Improve this Doc View Source

    IsConnected

    Gets the state, if the connection is established or not.

    Declaration
    public bool IsConnected { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Connect()

    Connects the internal Mqtt client with the prepared options and invokes the Failed event if an error occures.

    Declaration
    public IConnectable Connect()
    Returns
    Type Description
    IConnectable

    The calling instance.

    | Improve this Doc View Source

    ConnectAsync()

    Connects the internal Mqtt client asynchronously with the prepared options and invokes the Failed event if an error occures.

    Declaration
    public Task ConnectAsync()
    Returns
    Type Description
    Task

    The executing task.

    | Improve this Doc View Source

    Disconnect()

    Disconnects the internal Mqtt client.

    Declaration
    public IConnectable Disconnect()
    Returns
    Type Description
    IConnectable

    The calling instance.

    | Improve this Doc View Source

    DisconnectAsync()

    Disconnects the internal Mqtt client asynchronously.

    Declaration
    public Task DisconnectAsync()
    Returns
    Type Description
    Task

    The executing task.

    | Improve this Doc View Source

    PublishAsync(String, String)

    Sends a message string asynchronously to a given broker.

    Declaration
    public Task PublishAsync(string topic, string message)
    Parameters
    Type Name Description
    System.String topic

    The topic of the message.

    System.String message

    The message that will be sent.

    Returns
    Type Description
    Task

    The executing task.

    | Improve this Doc View Source

    PublishAsync(String, String, Int32)

    Sends a message string asynchronously to a given broker.

    Declaration
    public Task PublishAsync(string topic, string message, int qualityOfService)
    Parameters
    Type Name Description
    System.String topic

    The topic of the message.

    System.String message

    The message that will be sent.

    System.Int32 qualityOfService

    The level of quality that will be used for sending.

    Returns
    Type Description
    Task

    The executing task.

    | Improve this Doc View Source

    Subscribe(String)

    Subscribes to a new topic that the client will listen to.

    Declaration
    public IMqttConnectable Subscribe(string topic)
    Parameters
    Type Name Description
    System.String topic

    The topic of interest.

    Returns
    Type Description
    IMqttConnectable

    The calling instance.

    | Improve this Doc View Source

    Unsubscribe(String)

    Unsubscribes from a topic that the client will no longer listen to.

    Declaration
    public IMqttConnectable Unsubscribe(string topic)
    Parameters
    Type Name Description
    System.String topic

    The topic that will be removed.

    Returns
    Type Description
    IMqttConnectable

    The calling instance.

    Events

    | Improve this Doc View Source

    Completed

    The event is invoked when the PublishAsync methods have finished successfully.

    Declaration
    public event ConnectorCompletedEventHandler Completed
    Event Type
    Type Description
    ConnectorCompletedEventHandler
    | Improve this Doc View Source

    Connected

    The event is invoked when the Connect method has finished successfully.

    Declaration
    public event ConnectorEventHandler Connected
    Event Type
    Type Description
    ConnectorEventHandler
    | Improve this Doc View Source

    Disconnected

    The event is invoked when the Disconnect method has finished successfully.

    Declaration
    public event ConnectorEventHandler Disconnected
    Event Type
    Type Description
    ConnectorEventHandler
    | Improve this Doc View Source

    Failed

    The event is invoked when any method or action has finished with a failure.

    Declaration
    public event ConnectorFailedEventHandler Failed
    Event Type
    Type Description
    ConnectorFailedEventHandler
    | Improve this Doc View Source

    MessageReceived

    The event is invoked when the subscription to a topic has received a message.

    Declaration
    public event MqttConnectorEventHandler MessageReceived
    Event Type
    Type Description
    MqttConnectorEventHandler

    Implements

    IMqttConnectable
    IConnectable
    IAsyncConnectable
    • GITHUB
    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top
    Copyright 2020-2022 TeleScope-dotnet. Generated by DocFX.
    ☀
    ☾