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);
}
}