public CommandMessengerBroker(CmdMessenger cmdMessenger, MqttOptions mqttOptions, Encoding encoding = null)
        {
            CmdMessenger = cmdMessenger;
            MqttClient   = mqttOptions.CreateMqttClient();
            MqttClient.ConnectionClosed += (sender, e) => MqttConnectionClosed?.Invoke(sender, e);

            Encoding = encoding ?? Encoding.UTF8;
        }
Exemplo n.º 2
0
 public CommandMessengerSendBroker(
     CmdMessenger cmdMessenger, MqttOptions mqttOptions,
     string topicPrefix = "", string unknownCommandTopic = "unknown-cmd",
     Encoding encoding  = null)
     : base(cmdMessenger, mqttOptions, encoding)
 {
     m_TopicPrefix         = topicPrefix;
     m_UnknownCommandTopic = unknownCommandTopic;
 }
Exemplo n.º 3
0
 public static MqttClient CreateMqttClient(this MqttOptions options)
 {
     return(new MqttClient(
                options.BrokerHostName,
                options.BrokerPort,
                options.Secure,
                options.CaCert,
                options.ClientCert,
                options.SslProtocol.ToMqtt()));
 }
 public CommandMessengerReceiveBroker(CmdMessenger cmdMessenger, MqttOptions mqttOptions, Encoding encoding = null)
     : base(cmdMessenger, mqttOptions, encoding)
 {
 }