AmiClient icon indicating copy to clipboard operation
AmiClient copied to clipboard

Not working AmiClient.Subscribe

Open GolDiV opened this issue 1 year ago • 0 comments

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?

GolDiV avatar Jun 28 '23 15:06 GolDiV