private static async Task SendMessageAsync(ChannelBase channel) { var chatService = new ChatService.ChatServiceClient(channel); try { var messageContent = string.Empty; while (messageContent != "exit") { Console.WriteLine("Enter message: "); messageContent = Console.ReadLine(); var message = new Message { Login = _login, Time = DateTime.UtcNow.ToTimestamp(), Content = messageContent ?? string.Empty }; await chatService.SendAsync(message); } } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); } CancellationTokenSource.Cancel(); }