2

I have spent many hours looking for a way to subscribe to a topic using the AWSSDK.IoT library. I can publish easily enough, but can't figure out the subscription part.

I am using the AmazonIotDataClient (AWSSDK.IotData), but have also tried the AmazonIotClient (AWSSDK.Iot). I am not having any luck with either. Just doesn't seem to be in the .NET SDK?

Code to publish:

public void SendMessage(string topic, PropertyCollection collection)
{    
     var json = collection.ToJson();
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(json)))
     {
         var request = new PublishRequest
         {
             Topic = topic,
             Payload = stream
         };
         _client.Publish(request);
     }
}
Spenduku
  • 409
  • 4
  • 12
  • 1
    From what I can tell, there is no way to do this with Amazons own .NET SDK. Seems like a massive oversight, but using a third party client like mqttnet or m2mqtt does allow me to both publish and subscribe quite easily. – Spenduku Jul 25 '18 at 17:01

0 Answers0