Esempio n. 1
0
 private async Task SendMessagesAsync()
 {
     using (await sendSemaphore.CreateLockScopeAsync().ConfigureAwait(false))
     {
         while (queue.TryDequeue(out var message))
         {
             await webSocket.SendMessageAsync(Encoding.UTF8.GetBytes(message)).ConfigureAwait(false);
         }
     }
 }