public async Task <IMqttClient> RegisterDevice(ICumulocityDevice device) { IConnectionDetails cDetails = new ConnectionDetailsBuilder() .WithClientId(device.ClientId) .WithHost(_baseUrlPath) .WithCredentials(BootstrapUser, Password) .WithCleanSession() .WithProtocol(TransportType.Tcp) .WithCleanSession() .Build(); var client = new MqttClient(cDetails); await client.EstablishConnectionAsync(); await client.SubscribeAsync(new MqttMessageRequest() { TopicName = "s/dcr" }); client.MessageReceived += (sender, response) => { Console.WriteLine(response.MessageContent); }; // var res = await _httpClient.PostAsync("/s/ucr", new StringContent("")); await client.PublishAsync(new MqttMessageRequestBuilder() .WithTopicName("s/ucr") .WithQoS(QoS.EXACTLY_ONCE) .WithMessageContent(string.Empty) .Build()); return(null); }