private async Task BackgroundSender(IDemoCallback callback)
 {
     int loop = 0;
     while ((callback as IChannel).State == CommunicationState.Opened)
     {
         await callback.SendMessage($"Hello from the server {loop++}");
         await Task.Delay(1000);
     }
 }
Ejemplo n.º 2
0
        private async Task BackgroundSender(IDemoCallback callback)
        {
            int loop = 0;

            while ((callback as IChannel).State == CommunicationState.Opened)
            {
                await callback.SendMessage($"Hello from the server {loop++}");

                await Task.Delay(1000);
            }
        }
Ejemplo n.º 3
0
        public async Task StartSendingMessages()
        {
            IDemoCallback callback = OperationContext.Current.GetCallbackChannel <IDemoCallback>();
            int           loop     = 0;

            while ((callback as IChannel).State == CommunicationState.Opened)
            {
                await callback.SendMessage($"Hello from the server {loop++}");

                await Task.Delay(1000);
            }
        }
Ejemplo n.º 4
0
        public void StartSendingMessages()
        {
            IDemoCallback callback = OperationContext.Current.GetCallbackChannel <IDemoCallback>();

            Task.Run(() => BackgroundSender(callback));
        }