/// <summary>
 /// Get an IAsyncEnumerable for receiving messages.
 /// </summary>
 public static async IAsyncEnumerable <Message> Messages(this IReceive receiver, [EnumeratorCancellation] CancellationToken cancellationToken = default)
 {
     while (!cancellationToken.IsCancellationRequested)
     {
         yield return(await receiver.Receive(cancellationToken).ConfigureAwait(false));
     }
 }
 protected override void OnProcess()
 {
     while (true)
     {
         foreach (var ch in Device429.ReceiveComponents)
         {
             IReceive receiveItem = ch as IReceive;
             if (receiveItem != null)
             {
                 receiveItem.Receive();
             }
         }
         Thread.Sleep(500);
     }
 }
Beispiel #3
0
 void Pong(IReceive <string> pings, ISend <string> pongs)
 {
     var(msg, _) = pings.Receive();
     pongs.Send(msg);
 }