private static async void Chat() { var server = new Server(); var client = new Client(); MessageResult result1 = await client.ConnectAsync(server); result1.ToString(); // SuccessMessageResult.ToString MessageResult result2 = await server.SendAsync("Hello from server!"); result2.ToString(); // SuccessMessageResult.ToString or ErrorMessageResult.ToString Task <MessageResult> task = client.SendAsync($"Hello from client {client.Id}!"); MessageResult result3 = await task; result3.ToString(); // ErrorMessageResult.ToString }