Is there any demo for C# and Wechaty GRPC
Created by: Edward-Zhou
Hi,
I made a test with Wechaty.Grpc
, and some demo code like below:
static async System.Threading.Tasks.Task Main(string[] args)
{
Console.WriteLine("Hello World!");
var url = @"https://api.chatie.io/v0/hosties/" + "puppet_padplus_XX";
HostieEndPoint model = new HostieEndPoint();
using (var client = new HttpClient())
{
var response = client.GetAsync(url).Result;
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
model = JsonConvert.DeserializeObject<HostieEndPoint>(await response.Content.ReadAsStringAsync());
}
}
string endPoint = model.IP + ":" + model.Port;
var channel = new Channel(endPoint, ChannelCredentials.Insecure);
var grpcClient = new PuppetClient(channel);
var rooms = grpcClient.RoomListAsync(new RoomListRequest()).GetAwaiter().GetResult();
}
I am wondering where I should to Scarn the QR code.
For above code, it will throw error below:
Grpc.Core.RpcException: 'Status(StatusCode="Unavailable", Detail="failed to connect to all addresses", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1601300625.154000000","description":"Failed to pick subchannel","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\ext\filters\client_channel\client_channel.cc","file_line":4090,"referenced_errors":[{"created":"@1601300625.154000000","description":"failed to connect to all addresses","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x64\src\core\ext\filters\client_channel\lb_policy\pick_first\pick_first.cc","file_line":394,"grpc_status":14}]}")'
Any help would be appreciated!
FYI,
I am able to get the expected IP:Port.
@huan