AmiClient
AmiClient copied to clipboard
Not working AmiClient.Subscribe
I dont understand why method Subscribe not working. Example: This code
var response = await amiClient.Where(message => message["Event"] == "Newstate").FirstAsync();
foreach (var item in response)
{
Console.WriteLine(item.Key + ":" + item.Value);
}
work good, but this:
var subscription = ami.Where(message => message["Event"] == "Newstate")
.Subscribe(response =>
{
if (response != null)
{
foreach (var item in response)
{
Console.WriteLine(item.Key + ":" + item.Value);
}
}
});
not work. I wait that this code wait all events "Newstate" and write to console. What am I doing wrong?