/// Create MQTT router and MQTT client public Mqtt(string IP, MqttConfiguration config, MqttClientCredentials creds = null) { var client = MqttClient.CreateAsync(IP, config); client.Wait(); Client = client.Result; Task <SessionState> conn; if (creds == null) { conn = Client.ConnectAsync(); } else { conn = Client.ConnectAsync(creds); } conn.Wait(); On = new MqttRouter(Client); }
public Mqtt(string v, MqttClientCredentials creds, IMqttClient client) { this.Client = client; On = new MqttRouter(client); }